move the ipfilter clientip to the conditional
This commit is contained in:
parent
0d5f87b6d7
commit
3ad319cda6
1 changed files with 5 additions and 5 deletions
|
|
@ -52,13 +52,13 @@ app.get('/headers', function (req, res) {
|
||||||
res.status(200).send('success');
|
res.status(200).send('success');
|
||||||
});
|
});
|
||||||
//restrict access to anything else via ip addresses based on x-forwarded for
|
//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
|
//@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] : ""
|
|
||||||
};
|
|
||||||
|
|
||||||
if(config.ipfilter.allowed_ips.length > 0){
|
if(config.ipfilter.allowed_ips.length > 0){
|
||||||
console.log("using ip filter");
|
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(
|
app.use(
|
||||||
ipFilter({
|
ipFilter({
|
||||||
detectIp: clientIp,
|
detectIp: clientIp,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue