Connect/Express middleware to limit requests based on express-rate-limit
Install package:
npm install reqlim
OR
yarn add reqlim
Import and use middleware:
const rateLimit = require('reqlim')
app.use(rateLimit())
- Default:
1000
How long to keep records of requests in memory (milliseconds)
- Default:
5
Max number of recent connections during window
milliseconds before sending a 429 response
- Default:
429
Status when limit reached for Too Many Requests (RFC 6585)
- Default:
true
Send custom rate limit header with limit and remaining
- Default:
false
Do not count failed requests (status >= 400
)
- Default:
false
Do not count successful requests (status < 400
)
- Default:
req => req.ip + '_' + req.url
Allows to create custom keys
Allows to create custom request IP getter
- Default:
() => false
Skip certain requests
Handler in case of reate limits
A custom callback when rate limit reached
Based on https://github.com/nfriedly/express-rate-limit (MIT)
Made with 💖