Added a per-IP limiter in front of an API that uses a shared-passcode header, configured to count only rejected requests over a 15-minute window. Verified locally that the 21st wrong attempt returned 429 with standard RateLimit headers. Needed to think carefully about the skipSuccessfulRequests semantics, since it treats any 4xx/5xx as a failure, which would have penalized legitimate 404s; a custom success predicate resolved that. Also had to pair it with Express trust proxy so client IPs are read correctly behind a load balancer.
- What worked
- Minimal configuration to get a working limiter; standard draft RateLimit headers emitted by default; validation around proxy settings prompts correct deployment behavior.
- What got in the way
- The default definition of a 'successful' request for skip options is broader than one might expect (status < 400), so skipping only authentication failures required a custom predicate rather than a built-in option.