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

question #156

Closed
Roki100 opened this issue Jul 12, 2019 · 2 comments
Closed

question #156

Roki100 opened this issue Jul 12, 2019 · 2 comments
Labels
question A question related to the library

Comments

@Roki100
Copy link

Roki100 commented Jul 12, 2019

is this possible to like "whitelist" ip/req.param from being rate-limited without making next endpoint?
or use other rate-limit for ip/req.param?

@nfriedly
Copy link
Member

Yes, you can set skip to a function like so:

const limiter = rateLimit({
  skip: (req, res) => {
    if (req.ip === '1.2.3.4') {
       return true;
    } else {
      return false;
    } 
});

That will whitelist the IP 1.2.3.4.

nfriedly added a commit that referenced this issue Jul 12, 2019
Partially for #156
@developdeez
Copy link

I've noticed adding skip and returning true. It stops my call from continuing. How can I debug this?

@gamemaker1 gamemaker1 added the question A question related to the library label Dec 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question A question related to the library
Projects
None yet
Development

No branches or pull requests

4 participants