File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ services:
1616 HEROKU_APP_NAME : ${HEROKU_APP_NAME}
1717 ENABLED_LANGUAGES : ${ENABLED_LANGUAGES}
1818 DEPLOYMENT_ENV : ${DEPLOYMENT_ENV}
19+ RATE_LIMIT_MAX : ${RATE_LIMIT_MAX}
1920 HEROKU_PRODUCTION_APP : true
2021 PORT : 4000
2122 DD_AGENT_HOST : datadog-agent
Original file line number Diff line number Diff line change @@ -3,6 +3,11 @@ import statsd from '../lib/statsd.js'
33
44const EXPIRES_IN_AS_SECONDS = 60
55
6+ const MAX = process . env . RATE_LIMIT_MAX ? parseInt ( process . env . RATE_LIMIT_MAX , 10 ) : 1000
7+ if ( isNaN ( MAX ) ) {
8+ throw new Error ( `process.env.RATE_LIMIT_MAX (${ process . env . RATE_LIMIT_MAX } ) not a number` )
9+ }
10+
611export default rateLimit ( {
712 // 1 minute
813 windowMs : EXPIRES_IN_AS_SECONDS * 1000 ,
@@ -13,7 +18,7 @@ export default rateLimit({
1318 // by the current number of instances.
1419 // We have see DDoS attempts against prod that hits the `/` endpoint
1520 // (and not following the redirect to `/en`) at roughly 200k per minute.
16- max : process . env . NODE_ENV === 'test' ? 1000 : 100 ,
21+ max : MAX ,
1722
1823 // Return rate limit info in the `RateLimit-*` headers
1924 standardHeaders : true ,
You can’t perform that action at this time.
0 commit comments