Fix /browse query redirects
This commit is contained in:
14
modules/middleware/noQuery.js
Normal file
14
modules/middleware/noQuery.js
Normal 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();
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user