Fix /browse query redirects

This commit is contained in:
Michael Jackson
2019-08-08 09:46:12 -07:00
parent 8aa619727e
commit a718d90549
4 changed files with 43 additions and 2 deletions

View File

@ -0,0 +1,14 @@
/**
* Strips all query params from the URL to increase cache hit rates.
*/
export default function noQuery() {
return (req, res, next) => {
const keys = Object.keys(req.query);
if (keys.length) {
return res.redirect(302, req.baseUrl + req.path);
}
next();
};
}