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": {
|
"send": {
|
||||||
"from": "mono@fyle.uk"
|
"from": "mono@fyle.uk"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
|
"forceSSL": true
|
||||||
}
|
}
|
|
@ -28,6 +28,14 @@ app.use("/static/js",express.static("out/client"))
|
||||||
|
|
||||||
app.use(cookieParser())
|
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) => {
|
app.get("/server",(req,res) => {
|
||||||
res.send(JSON.stringify({
|
res.send(JSON.stringify({
|
||||||
...config,
|
...config,
|
||||||
|
|
Loading…
Reference in a new issue