initial: force-ssl

This commit is contained in:
split / May 2023-10-01 10:31:18 -07:00
parent 7d3b1b5703
commit cb17eb1433
2 changed files with 11 additions and 1 deletions

View file

@ -24,5 +24,7 @@
"send": {
"from": "mono@fyle.uk"
}
}
},
"forceSSL": true
}

View file

@ -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,