Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

134
Views
Node.js/Express.js API rate limit

Context: The API that I need to rate-limit is request OTP. A user needs to request it to be able to log in. He can use his phone or email.

By that stage, I don't have the user id or JWT token yet. That's why I first decided to limit the API by a user's IP address.

An example of set up:

  windowMs: 10 * 60 * 1000,
  max: 5,
  message: "Too many requests, please try again later in 10 minutes",
  keyGenerator: (request, response) => {
    return requestIp.getClientIp(request);
  },
});

However, what I don't like in this approach is that a user can change the IP by proxy or so and avoid the limitation. I could set the limiting by for example phone/email that a user sends in the request and the IP, but email/phone also could be easily changed.

My questions:

  1. What you can advise in the case that I described above? I mean, maybe there is a way to limit a user before we have his userId or token
  2. What is better practice in the rate-limiting? I mean, maybe instead of limiting users separately the better option is to make a limit on the app itself, or another way
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!