mirror of
https://github.com/mollersuite/monofile.git
synced 2024-11-21 21:36:26 -08:00
initial: force-ssl
This commit is contained in:
parent
7d3b1b5703
commit
cb17eb1433
|
@ -24,5 +24,7 @@
|
|||
"send": {
|
||||
"from": "mono@fyle.uk"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"forceSSL": true
|
||||
}
|
|
@ -28,6 +28,14 @@ app.use("/static/js",express.static("out/client"))
|
|||
|
||||
app.use(cookieParser())
|
||||
|
||||
// check for ssl, if not redirect
|
||||
if (config.forceSSL) {
|
||||
app.use((req,res,next) => {
|
||||
if (!req.secure) res.redirect(`https://${req.get("host")}${req.originalUrl}`)
|
||||
else next()
|
||||
})
|
||||
}
|
||||
|
||||
app.get("/server",(req,res) => {
|
||||
res.send(JSON.stringify({
|
||||
...config,
|
||||
|
|
Loading…
Reference in a new issue