Use explicit status codes
This commit is contained in:
parent
b6f9176c71
commit
98cbffa590
|
@ -49,21 +49,21 @@ function packageURL(req, res, next) {
|
||||||
// Redirect /_meta/path to /path?meta.
|
// Redirect /_meta/path to /path?meta.
|
||||||
if (req.path.match(/^\/_meta\//)) {
|
if (req.path.match(/^\/_meta\//)) {
|
||||||
req.query.meta = ''
|
req.query.meta = ''
|
||||||
return res.redirect(req.path.substr(6) + createSearch(req.query))
|
return res.redirect(302, req.path.substr(6) + createSearch(req.query))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redirect /path?json => /path?meta
|
// Redirect /path?json => /path?meta
|
||||||
if (req.query.json != null) {
|
if (req.query.json != null) {
|
||||||
delete req.query.json
|
delete req.query.json
|
||||||
req.query.meta = ''
|
req.query.meta = ''
|
||||||
return res.redirect(req.path + createSearch(req.query))
|
return res.redirect(302, req.path + createSearch(req.query))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redirect requests with unknown query params to their equivalents
|
// Redirect requests with unknown query params to their equivalents
|
||||||
// with only known params so they can be served from the cache. This
|
// with only known params so they can be served from the cache. This
|
||||||
// prevents people using random query params designed to bust the cache.
|
// prevents people using random query params designed to bust the cache.
|
||||||
if (!queryIsKnown(req.query))
|
if (!queryIsKnown(req.query))
|
||||||
return res.redirect(req.path + createSearch(sanitizeQuery(req.query)))
|
return res.redirect(302, req.path + createSearch(sanitizeQuery(req.query)))
|
||||||
|
|
||||||
const url = parsePackageURL(req.url)
|
const url = parsePackageURL(req.url)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue