mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-27 00:42:40 +00:00
Added middleware to force all routes to be https
This commit is contained in:
7
server/forcessl.mw.js
Normal file
7
server/forcessl.mw.js
Normal file
@@ -0,0 +1,7 @@
|
||||
module.exports = (req, res, next) => {
|
||||
if(process.env.NODE_ENV === 'local') return next();
|
||||
if(req.header('x-forwarded-proto') !== 'https') {
|
||||
return res.redirect(302, `https://${req.get('Host')}${req.url}`);
|
||||
}
|
||||
return next();
|
||||
};
|
||||
Reference in New Issue
Block a user