Increase max-age on some redirects

This commit is contained in:
Michael Jackson 2018-08-07 18:59:45 -07:00
parent a5db17cd6a
commit 6d57d95b7f
2 changed files with 3 additions and 4 deletions

View File

@ -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 {

View File

@ -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(