0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 20:42:43 +00:00
Files
homebrewery/server/forcessl.mw.js
2019-01-22 11:26:33 -05:00

8 lines
231 B
JavaScript

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();
};