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