From b61082d3fd910b2d667ce6077ad2487d0bf8d5c6 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Sat, 23 May 2020 16:24:05 -0700 Subject: [PATCH] Fixed AgentPort server crash. --- webserver.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webserver.js b/webserver.js index 0c650efb..bdbf48bd 100644 --- a/webserver.js +++ b/webserver.js @@ -4093,9 +4093,9 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { ) { if (req.headers['cf-connecting-ip']) { // Use CloudFlare IP address if present req.clientIp = req.headers['cf-connecting-ip'].split(',')[0].trim(); - } else if (res.headers['x-forwarded-for']) { + } else if (req.headers['x-forwarded-for']) { req.clientIp = req.headers['x-forwarded-for'].split(',')[0].trim(); - } else if (res.headers['x-real-ip']) { + } else if (req.headers['x-real-ip']) { req.clientIp = req.headers['x-real-ip'].split(',')[0].trim(); } else { req.clientIp = ipex;