Update setting cleint ip in agentonly webrequest
Noah Zalev committed
Aug 31, 2021 at 10:35 UTC
2cd9a56046fd347ad095fbe1b040c7ee2f689da3
1 file changed
+3
-3
webserver.js
+3
-3
@@ -5572,9 +5572,9 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
5572
var ipex = '0.0.0.0';
5573
if (typeof req.connection.remoteAddress == 'string') { ipex = (req.connection.remoteAddress.startsWith('::ffff:')) ? req.connection.remoteAddress.substring(7) : req.connection.remoteAddress; }
5574
if (
5575
- (obj.args.trustedproxy === true) ||
5576
- ((typeof obj.args.trustedproxy == 'object') && (obj.args.trustedproxy.indexOf(ipex) >= 0)) ||
5577
- ((typeof obj.args.tlsoffload == 'object') && (obj.args.tlsoffload.indexOf(ipex) >= 0))
5575
+ (obj.args.trustedproxy === true) || (obj.args.tlsoffload === true) ||
5576
+ ((typeof obj.args.trustedproxy == 'object') && (isIPMatch(ipex, obj.args.trustedproxy))) ||
5577
+ ((typeof obj.args.tlsoffload == 'object') && (isIPMatch(ipex, obj.args.tlsoffload)))
5578
) {
5579
if (req.headers['cf-connecting-ip']) { // Use CloudFlare IP address if present
5580
req.clientIp = req.headers['cf-connecting-ip'].split(',')[0].trim();