Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in IIS reserve proxy [Access denied to IP address: undefined] #183

Open
imtiazahmeddahar opened this issue Jun 13, 2024 · 0 comments

Comments

@imtiazahmeddahar
Copy link

I am using expressjs (nodejs) and tried to use this package to filter out IP addresses but getting below error:

Access denied to IP address: undefined

I have also tried proxy option too:

app.set('trust proxy', true);

My configurations:

const whitelistedIPs = [
  "some-ip-address", // Replace with actual IP addresses
  "127.0.0.1",
  "::1",
  
];

const ipBlocker = ipfilter(whitelistedIPs, {
  mode: "allow", //logLevel: "deny"
});

app.use((err, req, res, next) => {
  if (err instanceof IpDeniedError) {
    return res.status(403).send("Your IP is not allowed to access this resource.");
  } else {
    next(err);
  }
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant