Increase max-age on some redirects
This commit is contained in:
parent
a5db17cd6a
commit
6d57d95b7f
modules/middleware
|
@ -90,10 +90,9 @@ function filenameRedirect(req, res) {
|
|||
|
||||
// Redirect to the exact filename so relative imports
|
||||
// and URLs resolve correctly.
|
||||
// TODO: increase the max-age?
|
||||
res
|
||||
.set({
|
||||
"Cache-Control": "public,max-age=60",
|
||||
"Cache-Control": "public,max-age=31536000", // 1 year
|
||||
"Cache-Tag": "redirect,filename-redirect"
|
||||
})
|
||||
.redirect(
|
||||
|
@ -126,6 +125,7 @@ function fetchPackage(req, res, next) {
|
|||
req.packageConfig = req.packageInfo.versions[req.packageVersion];
|
||||
|
||||
if (!req.packageConfig) {
|
||||
// Redirect to a fully-resolved version.
|
||||
if (req.packageVersion in req.packageInfo["dist-tags"]) {
|
||||
return tagRedirect(req, res);
|
||||
} else {
|
||||
|
|
|
@ -10,10 +10,9 @@ const getContentType = require("../utils/getContentType");
|
|||
function indexRedirect(req, res, entry) {
|
||||
// Redirect to the index file so relative imports
|
||||
// resolve correctly.
|
||||
// TODO: increase the max-age?
|
||||
res
|
||||
.set({
|
||||
"Cache-Control": "public,max-age=60",
|
||||
"Cache-Control": "public,max-age=31536000", // 1 year
|
||||
"Cache-Tag": "redirect,index-redirect"
|
||||
})
|
||||
.redirect(
|
||||
|
|
Loading…
Reference in New Issue