Skip to content

Commit

Permalink
Repeated download issue fix
Browse files Browse the repository at this point in the history
  • Loading branch information
colloqi committed Apr 26, 2023
1 parent 2342e1c commit 0d7a126
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions config/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ module.exports = function (app) {

//app.use('/sync_folders',serveIndex(config.syncDir));
app.use('/sync_folders',function(req, res, next){
// Player uses --no-cache header in wget to download assets. The --no-cache flag sends the following headers
// Cache-Control: no-cache , Pragma: no-cache
// This causes 200 OK response for all requests. Hence remove this header to minimise data-transfer costs.
delete req.headers['cache-control']; // delete header
delete req.headers['pragma']; // delete header
fs.stat(path.join(config.syncDir,req.path), function(err, stat){
if (!err && stat.isDirectory()) {
res.setHeader('Last-Modified', (new Date()).toUTCString());
Expand Down

0 comments on commit 0d7a126

Please sign in to comment.