mirror of
https://github.com/mollersuite/monofile.git
synced 2024-11-24 14:46:27 -08:00
force-ssl: trustproxy
This commit is contained in:
parent
1d387de3dd
commit
3bf0e7491a
|
@ -26,5 +26,6 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"trustProxy": true,
|
||||||
"forceSSL": true
|
"forceSSL": true
|
||||||
}
|
}
|
|
@ -29,6 +29,7 @@ app.use("/static/js",express.static("out/client"))
|
||||||
app.use(cookieParser())
|
app.use(cookieParser())
|
||||||
|
|
||||||
// check for ssl, if not redirect
|
// check for ssl, if not redirect
|
||||||
|
if (config.trustProxy) app.enable("trust proxy")
|
||||||
if (config.forceSSL) {
|
if (config.forceSSL) {
|
||||||
app.use((req,res,next) => {
|
app.use((req,res,next) => {
|
||||||
if (req.protocol == "http") res.redirect(`https://${req.get("host")}${req.originalUrl}`)
|
if (req.protocol == "http") res.redirect(`https://${req.get("host")}${req.originalUrl}`)
|
||||||
|
|
Loading…
Reference in a new issue