diff options
author | Tom Smeding <tom@tomsmeding.com> | 2021-08-01 10:15:57 +0200 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2021-08-01 10:17:50 +0200 |
commit | 6f6179b8c85a7b7143bfd625958e942e681c7864 (patch) | |
tree | d9fe8c4c12fa90860c5ff7bca8d6edef660f253a | |
parent | 3f6b91960119c43924d43387f4b54cf4b05aa043 (diff) |
Trust reverse proxy when enabled
-rwxr-xr-x | webserver.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/webserver.js b/webserver.js index 5496f11..f867c74 100755 --- a/webserver.js +++ b/webserver.js @@ -24,6 +24,14 @@ const httpServer = http.Server(app); const io = socketio(httpServer); +if ("NODE_TRUST_PROXY" in process.env && process.env["NODE_TRUST_PROXY"].length > 0) { + console.log("Note: Trusting reverse proxy's X-Forwarded-* headers."); + app.set("trust proxy", "loopback"); +} else { + console.log("Note: Not trusting reverse proxy. Set NODE_TRUST_PROXY to change."); +} + + // const reqlogger = new Logger("request_log.txt"); |