Skip to content

Commit 6a6dafa

Browse files
authored
Enable rate limiting (#25642)
* Enable rate limiting * higher limit specifically when running tests
1 parent f48d536 commit 6a6dafa

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

middleware/rate-limit.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default rateLimit({
1313
// by the current number of instances.
1414
// We have see DDoS attempts against prod that hits the `/` endpoint
1515
// (and not following the redirect to `/en`) at roughly 200k per minute.
16-
max: 100,
16+
max: process.env.NODE_ENV === 'test' ? 1000 : 100,
1717

1818
// Return rate limit info in the `RateLimit-*` headers
1919
standardHeaders: true,
@@ -23,10 +23,6 @@ export default rateLimit({
2323
handler: (request, response, next, options) => {
2424
const tags = [`url:${request.url}`, `ip:${request.ip}`]
2525
statsd.increment('middleware.rate_limit', 1, tags)
26-
// NOTE! At the time of writing, the actual rate limiting is disabled!
27-
// At least we can start recording how often this happens in Datadog.
28-
// The following line is commented out and replaced with `next()`
29-
// response.status(options.statusCode).send(options.message)
30-
next()
26+
response.status(options.statusCode).send(options.message)
3127
},
3228
})

0 commit comments

Comments
 (0)