From 3ad319cda6e8bf097eaaa883a1d1810057319e21 Mon Sep 17 00:00:00 2001 From: Tom Broughton Date: Mon, 30 Oct 2023 09:32:11 +0000 Subject: [PATCH] move the ipfilter clientip to the conditional --- app/server/app.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/server/app.js b/app/server/app.js index 36c7895..867dc41 100644 --- a/app/server/app.js +++ b/app/server/app.js @@ -52,13 +52,13 @@ app.get('/headers', function (req, res) { res.status(200).send('success'); }); //restrict access to anything else via ip addresses based on x-forwarded for -//@todo create environment var to determin to used this or the general req header -let clientIp = function(req, res) { - return req.headers['x-forwarded-for'] ? (req.headers['x-forwarded-for']).split(',')[0] : "" -}; - +//@todo create environment var to determin to used this or the general req header if(config.ipfilter.allowed_ips.length > 0){ console.log("using ip filter"); + let clientIp = function(req, res) { + return req.headers['x-forwarded-for'] ? (req.headers['x-forwarded-for']).split(',')[0] : ""; + }; + app.use( ipFilter({ detectIp: clientIp,