Repository navigation
3.1.0 (2026-11-19)
Features
- add dry run mode to HTTP limiters (#20) (c9abb76)
- emit limit:exceeded event when a request is rejected (#21) (85e6f82)
Bug Fixes
The limit:exceeded event
The limiter emits limit:exceeded each time it rejects a request. Use it to log abusive clients or to send metrics. The listener does not delay the request.
emitter.on('limit:exceeded', ({ key, response }) => {
logger.warn({ key, consumed: response.consumed }, 'rate limit exceeded')
})For a limiter of limiter.define(), the key starts with the name of the limiter, for example login_ip_127.0.0.1.
Dry run mode
.dryRun() counts the requests of an HTTP limiter, and never rejects them. When the limit is exceeded, limit:exceeded is emitted with dryRun: true. Use it to see the effect of a limit on real traffic before you enforce it.
limiter.allowRequests(100).every('1 hour').dryRun()The counters of a dry run use their own keys, so the enforced limit starts from fresh counters. No rate limit header is set, and the limitExceeded callback is not called. dryRun(false) turns it off, so an environment variable can drive it.
clear() of the Redis store
clear() of the Redis store ran FLUSHDB, so it also deleted the sessions, jobs and cache of an app that keeps them in the same Redis database. It now deletes only the keys under the keyPrefix of the store (rlflx by default), on each master node of a cluster. A Redis store with no keyPrefix now throws when you call clear().
What's Changed
- feat: add dry run mode to HTTP limiters by @MaximeMRF in #20
Full Changelog: v3.0.1...v3.1.0