summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2021-08-01 10:15:57 +0200
committerTom Smeding <tom@tomsmeding.com>2021-08-01 10:17:50 +0200
commit6f6179b8c85a7b7143bfd625958e942e681c7864 (patch)
treed9fe8c4c12fa90860c5ff7bca8d6edef660f253a
parent3f6b91960119c43924d43387f4b54cf4b05aa043 (diff)
Trust reverse proxy when enabled
-rwxr-xr-xwebserver.js8
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");