From 0a368ff55316f2cfbf2f2d3d5292937b42946564 Mon Sep 17 00:00:00 2001 From: Zoe Date: Mon, 4 Jul 2022 20:36:03 +0200 Subject: [PATCH] feat: add x-real-ip as a secondary header for client ip Now allows both x-forwarded-for as well as x-real-ip to be used for the client ip, preferring x-forwarded-for --- server/server.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/server.js b/server/server.js index e74abafff..476f8664a 100644 --- a/server/server.js +++ b/server/server.js @@ -1677,7 +1677,8 @@ async function shutdownFunction(signal) { } function getClientIp(socket) { - return socket.client.conn.request.headers["x-forwarded-for"] + return socket.client.conn.request.headers["x-forwarded-for"] + || socket.client.conn.request.headers["x-real-ip"] || socket.client.conn.remoteAddress.replace(/^.*:/, ""); }