Add Cache-Tag headers

This commit is contained in:
MICHAEL JACKSON
2017-08-12 17:23:40 -07:00
parent 5f2805c2e9
commit db69375e9c
8 changed files with 66 additions and 95 deletions

View File

@ -19,12 +19,12 @@ function parseURL(req, res, next) {
const url = PackageURL.parse(req.url)
if (url == null)
return res.status(403).send(`Invalid URL: ${req.url}`)
return res.status(403).type('text').send(`Invalid URL: ${req.url}`)
// Do not allow unrecognized query parameters because
// some people use them to bust the cache.
if (!queryIsValid(url.query))
return res.status(403).send(`Invalid query: ${JSON.stringify(url.query)}`)
return res.status(403).type('text').send(`Invalid query: ${JSON.stringify(url.query)}`)
req.packageName = url.packageName
req.packageVersion = url.packageVersion