From 4249815c5504d3f4fd1908f6cbd955f9b81b3299 Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Thu, 8 May 2025 01:19:31 -0600 Subject: [PATCH] Add REALIP env var --- index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.js b/index.js index d585a09..ac751b1 100644 --- a/index.js +++ b/index.js @@ -59,6 +59,7 @@ global.wsConnections = []; var roomList = []; // IEM WebSocket app.ws('/iem', (ws, req) => { + req.ip = process.env.REALIP ? req.headers[process.env.REALIP.toLowerCase()] : req.ip; console.log(`connection from ${req.ip}`); const hostname = process.env.HOST_OVERRIDE || os.hostname(); @@ -101,6 +102,7 @@ app.ws('/iem', (ws, req) => { "error": "Invalid JSON format." } })); + console.log(`${colors.red("[ERROR]")} Invalid JSON format from ${req.ip}: ${msg}`); return; } if (!data.type) return ws.send(JSON.stringify({