disable rate limiter feature flag
This commit is contained in:
30
src/index.ts
30
src/index.ts
@@ -116,21 +116,23 @@ app.use(compression());
|
|||||||
app.set('trust proxy', 1);
|
app.set('trust proxy', 1);
|
||||||
app.use(logHttp);
|
app.use(logHttp);
|
||||||
app.use(handleResponseTime);
|
app.use(handleResponseTime);
|
||||||
app.use(
|
if (!FEATURE_FLAGS.DISABLE_RATE_LIMIT) {
|
||||||
rateLimit({
|
app.use(
|
||||||
windowMs: 1000, // 1 second
|
rateLimit({
|
||||||
max: rateLimitCallsPerSecond,
|
windowMs: 1000, // 1 second
|
||||||
standardHeaders: true, // Return rate limit info in the `RateLimit-*` headers
|
max: rateLimitCallsPerSecond,
|
||||||
legacyHeaders: false, // Disable the `X-RateLimit-*` headers
|
standardHeaders: true, // Return rate limit info in the `RateLimit-*` headers
|
||||||
skip: (req, _res) => {
|
legacyHeaders: false, // Disable the `X-RateLimit-*` headers
|
||||||
if (!loadTestAllowed) {
|
skip: (req, _res) => {
|
||||||
return false;
|
if (!loadTestAllowed) {
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return req.headers['user-agent'].includes('k6');
|
return req.headers['user-agent'].includes('k6');
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// strip off /dlob, if the request comes from exchange history server LB
|
// strip off /dlob, if the request comes from exchange history server LB
|
||||||
app.use((req, _res, next) => {
|
app.use((req, _res, next) => {
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ export const FEATURE_FLAGS = {
|
|||||||
DISABLE_GPA_REFRESH: process.env.DISABLE_GPA_REFRESH
|
DISABLE_GPA_REFRESH: process.env.DISABLE_GPA_REFRESH
|
||||||
? process.env.DISABLE_GPA_REFRESH.toLowerCase() === 'true'
|
? process.env.DISABLE_GPA_REFRESH.toLowerCase() === 'true'
|
||||||
: false,
|
: false,
|
||||||
|
|
||||||
|
DISABLE_RATE_LIMIT: process.env.DISABLE_RATE_LIMIT
|
||||||
|
? process.env.DISABLE_RATE_LIMIT.toLowerCase() === 'true'
|
||||||
|
: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default FEATURE_FLAGS;
|
export default FEATURE_FLAGS;
|
||||||
|
|||||||
Reference in New Issue
Block a user