Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Commit

Permalink
Use "immutable" Cache-Control extension
Browse files Browse the repository at this point in the history
  • Loading branch information
mjackson committed Sep 1, 2018
1 parent fe48506 commit 2fc84df
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion modules/actions/serveJavaScriptModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function serveJavaScriptModule(req, res) {
.set({
"Content-Length": Buffer.byteLength(code),
"Content-Type": getContentTypeHeader(req.entry.contentType),
"Cache-Control": "public,max-age=31536000", // 1 year
"Cache-Control": "public, max-age=31536000, immutable", // 1 year
ETag: etag(code),
"Cache-Tag": "file,js-file,js-module"
})
Expand Down
2 changes: 1 addition & 1 deletion modules/actions/serveMetadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function serveMetadata(req, res) {

res
.set({
"Cache-Control": "public,max-age=31536000", // 1 year
"Cache-Control": "public, max-age=31536000, immutable", // 1 year
"Cache-Tag": "meta"
})
.send(metadata);
Expand Down
2 changes: 1 addition & 1 deletion modules/actions/serveStaticFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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", // 1 year
"Cache-Control": "public, max-age=31536000, immutable", // 1 year
"Last-Modified": req.entry.lastModified,
ETag: etag(req.entry.content),
"Cache-Tag": tags.join(",")
Expand Down
4 changes: 2 additions & 2 deletions modules/middleware/fetchPackage.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ function filenameRedirect(req, res) {
// and URLs resolve correctly.
res
.set({
"Cache-Control": "public,max-age=31536000", // 1 year
"Cache-Tag": "redirect,filename-redirect"
"Cache-Control": "public, max-age=31536000, immutable", // 1 year
"Cache-Tag": "redirect, filename-redirect"
})
.redirect(
302,
Expand Down
4 changes: 2 additions & 2 deletions modules/middleware/findFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ function indexRedirect(req, res, entry) {
// resolve correctly.
res
.set({
"Cache-Control": "public,max-age=31536000", // 1 year
"Cache-Tag": "redirect,index-redirect"
"Cache-Control": "public, max-age=31536000, immutable", // 1 year
"Cache-Tag": "redirect, index-redirect"
})
.redirect(
302,
Expand Down

0 comments on commit 2fc84df

Please sign in to comment.