mirror of
https://github.com/mollersuite/monofile.git
synced 2024-11-21 21:36:26 -08:00
force-ssl: switch to req.protocol?
This commit is contained in:
parent
cb17eb1433
commit
1d387de3dd
|
@ -31,7 +31,7 @@ app.use(cookieParser())
|
||||||
// check for ssl, if not redirect
|
// check for ssl, if not redirect
|
||||||
if (config.forceSSL) {
|
if (config.forceSSL) {
|
||||||
app.use((req,res,next) => {
|
app.use((req,res,next) => {
|
||||||
if (!req.secure) res.redirect(`https://${req.get("host")}${req.originalUrl}`)
|
if (req.protocol == "http") res.redirect(`https://${req.get("host")}${req.originalUrl}`)
|
||||||
else next()
|
else next()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue