diff --git a/modules/actions/serveHTMLModule.js b/modules/actions/serveHTMLModule.js index 8d0cd00..0d9ffef 100644 --- a/modules/actions/serveHTMLModule.js +++ b/modules/actions/serveHTMLModule.js @@ -20,7 +20,7 @@ function serveHTMLModule(req, res) { .set({ 'Content-Length': Buffer.byteLength(code), 'Content-Type': getContentTypeHeader(req.entry.contentType), - 'Cache-Control': 'public, max-age=31536000, immutable', // 1 year + 'Cache-Control': 'public, max-age=31536000', // 1 year ETag: etag(code), 'Cache-Tag': 'file, html-file, html-module' }) diff --git a/modules/actions/serveJavaScriptModule.js b/modules/actions/serveJavaScriptModule.js index 45e38ee..419416a 100644 --- a/modules/actions/serveJavaScriptModule.js +++ b/modules/actions/serveJavaScriptModule.js @@ -14,7 +14,7 @@ function serveJavaScriptModule(req, res) { .set({ 'Content-Length': Buffer.byteLength(code), 'Content-Type': getContentTypeHeader(req.entry.contentType), - 'Cache-Control': 'public, max-age=31536000, immutable', // 1 year + 'Cache-Control': 'public, max-age=31536000', // 1 year ETag: etag(code), 'Cache-Tag': 'file, js-file, js-module' }) diff --git a/modules/actions/serveMetadata.js b/modules/actions/serveMetadata.js index 5c44c8c..8eb8c35 100644 --- a/modules/actions/serveMetadata.js +++ b/modules/actions/serveMetadata.js @@ -35,7 +35,7 @@ function serveMetadata(req, res) { res .set({ - 'Cache-Control': 'public, max-age=31536000, immutable', // 1 year + 'Cache-Control': 'public, max-age=31536000', // 1 year 'Cache-Tag': 'meta' }) .send(metadata); diff --git a/modules/actions/serveStaticFile.js b/modules/actions/serveStaticFile.js index 32c66ee..902fad8 100644 --- a/modules/actions/serveStaticFile.js +++ b/modules/actions/serveStaticFile.js @@ -15,7 +15,7 @@ function serveStaticFile(req, res) { .set({ 'Content-Length': req.entry.size, 'Content-Type': getContentTypeHeader(req.entry.contentType), - 'Cache-Control': 'public, max-age=31536000, immutable', // 1 year + 'Cache-Control': 'public, max-age=31536000', // 1 year 'Last-Modified': req.entry.lastModified, ETag: etag(req.entry.content), 'Cache-Tag': tags.join(', ') diff --git a/modules/middleware/fetchPackage.js b/modules/middleware/fetchPackage.js index a4cdb71..12edc1e 100644 --- a/modules/middleware/fetchPackage.js +++ b/modules/middleware/fetchPackage.js @@ -92,7 +92,7 @@ function filenameRedirect(req, res) { // and URLs resolve correctly. res .set({ - 'Cache-Control': 'public, max-age=31536000, immutable', // 1 year + 'Cache-Control': 'public, max-age=31536000', // 1 year 'Cache-Tag': 'redirect, filename-redirect' }) .redirect( diff --git a/modules/middleware/findFile.js b/modules/middleware/findFile.js index 6664bdf..615741d 100644 --- a/modules/middleware/findFile.js +++ b/modules/middleware/findFile.js @@ -12,7 +12,7 @@ function indexRedirect(req, res, entry) { // resolve correctly. res .set({ - 'Cache-Control': 'public, max-age=31536000, immutable', // 1 year + 'Cache-Control': 'public, max-age=31536000', // 1 year 'Cache-Tag': 'redirect, index-redirect' }) .redirect( @@ -94,24 +94,26 @@ function searchEntries(tarballStream, entryName, wantsIndex) { const chunks = []; - stream.on('data', chunk => chunks.push(chunk)).on('end', () => { - const content = Buffer.concat(chunks); + stream + .on('data', chunk => chunks.push(chunk)) + .on('end', () => { + const content = Buffer.concat(chunks); - // Set some extra properties for files that we will - // need to serve them and for ?meta listings. - entry.contentType = getContentType(entry.name); - entry.integrity = getIntegrity(content); - entry.lastModified = header.mtime.toUTCString(); - entry.size = content.length; + // Set some extra properties for files that we will + // need to serve them and for ?meta listings. + entry.contentType = getContentType(entry.name); + entry.integrity = getIntegrity(content); + entry.lastModified = header.mtime.toUTCString(); + entry.size = content.length; - // Set the content only for the foundEntry and - // discard the buffer for all others. - if (entry === foundEntry) { - entry.content = content; - } + // Set the content only for the foundEntry and + // discard the buffer for all others. + if (entry === foundEntry) { + entry.content = content; + } - next(); - }); + next(); + }); }); }); }