From 88496f1ea36de2b2bf39c0834a411cbcafae27e8 Mon Sep 17 00:00:00 2001 From: Konstantinos Kopanidis Date: Tue, 21 Nov 2023 15:48:54 +0200 Subject: [PATCH] refactor(router): do not count OPTIONS requests towards request limit (#804) --- modules/router/src/security/handlers/rate-limiter/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/router/src/security/handlers/rate-limiter/index.ts b/modules/router/src/security/handlers/rate-limiter/index.ts index 5e9db719a..c0af6deb9 100644 --- a/modules/router/src/security/handlers/rate-limiter/index.ts +++ b/modules/router/src/security/handlers/rate-limiter/index.ts @@ -24,6 +24,7 @@ export class RateLimiter { get limiter() { const self = this; return (req: any, res: any, next: any) => { + if (req.method === 'OPTIONS') return next(); const ip = req.headers['cf-connecting-ip'] || req.headers['x-original-forwarded-for'] ||