Use "immutable" Cache-Control extension
See http://bitsup.blogspot.com/2016/05/cache-control-immutable.html for more info. Fixes #103 Closes #119
This commit is contained in:
parent
fe485060ff
commit
2fc84dfe45
|
@ -40,7 +40,7 @@ function serveJavaScriptModule(req, res) {
|
||||||
.set({
|
.set({
|
||||||
"Content-Length": Buffer.byteLength(code),
|
"Content-Length": Buffer.byteLength(code),
|
||||||
"Content-Type": getContentTypeHeader(req.entry.contentType),
|
"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),
|
ETag: etag(code),
|
||||||
"Cache-Tag": "file,js-file,js-module"
|
"Cache-Tag": "file,js-file,js-module"
|
||||||
})
|
})
|
||||||
|
|
|
@ -35,7 +35,7 @@ function serveMetadata(req, res) {
|
||||||
|
|
||||||
res
|
res
|
||||||
.set({
|
.set({
|
||||||
"Cache-Control": "public,max-age=31536000", // 1 year
|
"Cache-Control": "public, max-age=31536000, immutable", // 1 year
|
||||||
"Cache-Tag": "meta"
|
"Cache-Tag": "meta"
|
||||||
})
|
})
|
||||||
.send(metadata);
|
.send(metadata);
|
||||||
|
|
|
@ -15,7 +15,7 @@ function serveStaticFile(req, res) {
|
||||||
.set({
|
.set({
|
||||||
"Content-Length": req.entry.size,
|
"Content-Length": req.entry.size,
|
||||||
"Content-Type": getContentTypeHeader(req.entry.contentType),
|
"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,
|
"Last-Modified": req.entry.lastModified,
|
||||||
ETag: etag(req.entry.content),
|
ETag: etag(req.entry.content),
|
||||||
"Cache-Tag": tags.join(",")
|
"Cache-Tag": tags.join(",")
|
||||||
|
|
|
@ -92,8 +92,8 @@ function filenameRedirect(req, res) {
|
||||||
// and URLs resolve correctly.
|
// and URLs resolve correctly.
|
||||||
res
|
res
|
||||||
.set({
|
.set({
|
||||||
"Cache-Control": "public,max-age=31536000", // 1 year
|
"Cache-Control": "public, max-age=31536000, immutable", // 1 year
|
||||||
"Cache-Tag": "redirect,filename-redirect"
|
"Cache-Tag": "redirect, filename-redirect"
|
||||||
})
|
})
|
||||||
.redirect(
|
.redirect(
|
||||||
302,
|
302,
|
||||||
|
|
|
@ -12,8 +12,8 @@ function indexRedirect(req, res, entry) {
|
||||||
// resolve correctly.
|
// resolve correctly.
|
||||||
res
|
res
|
||||||
.set({
|
.set({
|
||||||
"Cache-Control": "public,max-age=31536000", // 1 year
|
"Cache-Control": "public, max-age=31536000, immutable", // 1 year
|
||||||
"Cache-Tag": "redirect,index-redirect"
|
"Cache-Tag": "redirect, index-redirect"
|
||||||
})
|
})
|
||||||
.redirect(
|
.redirect(
|
||||||
302,
|
302,
|
||||||
|
|
Loading…
Reference in New Issue