You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just want to let you know current RateLimit in startServer.ts is obsolete, there is breaking change on express-rate-limit api:
v3 changes: Removed delayAfter and delayMs options; they were moved to a new module: express-slow-down.
Also, now RateLimit usage also updated:
Instead of creating RateLimit instance directly, now it should be used as a factory method:
Usage taken from its official npm page:
const limiter = rateLimit({
windowMs: 15 * 60 * 1000, // 15 minutes
max: 100 // limit each IP to 100 requests per windowMs
});
And here is the usage of express-slow-down:
const slowDown = require("express-slow-down");
app.enable("trust proxy"); // only if you're behind a reverse proxy (Heroku, Bluemix, AWS if you use an ELB, custom Nginx setup, etc)
const speedLimiter = slowDown({
windowMs: 15 * 60 * 1000, // 15 minutes
delayAfter: 100, // allow 100 requests per 15 minutes, then...
delayMs: 500 // begin adding 500ms of delay per request above 100:
// request # 101 is delayed by 500ms
// request # 102 is delayed by 1000ms
// request # 103 is delayed by 1500ms
// etc.
});
// apply to all requests
app.use(speedLimiter);
The text was updated successfully, but these errors were encountered:
humoyun
changed the title
Need to update RateLimit options (delayMs)
Need to update usage of RateLimit itself and its options (delayMs)
May 9, 2020
Hi Ben,
I just want to let you know current RateLimit in startServer.ts is obsolete, there is breaking change on express-rate-limit api:
delayAfter
anddelayMs
options; they were moved to a new module: express-slow-down.Also, now RateLimit usage also updated:
Instead of creating RateLimit instance directly, now it should be used as a factory method:
Usage taken from its official npm page:
And here is the usage of express-slow-down:
The text was updated successfully, but these errors were encountered: