Skip to content

Commit

Permalink
force-ssl: trustproxy
Browse files Browse the repository at this point in the history
  • Loading branch information
nbitzz committed Oct 1, 2023
1 parent 1d387de commit 3bf0e74
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@
}
},

"trustProxy": true,
"forceSSL": true
}
1 change: 1 addition & 0 deletions src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ app.use("/static/js",express.static("out/client"))
app.use(cookieParser())

// check for ssl, if not redirect
if (config.trustProxy) app.enable("trust proxy")
if (config.forceSSL) {
app.use((req,res,next) => {
if (req.protocol == "http") res.redirect(`https://${req.get("host")}${req.originalUrl}`)
Expand Down

0 comments on commit 3bf0e74

Please sign in to comment.