Skip to content

Commit cd9822b

Browse files
committed
Add custom rate limiter
1 parent 8a99905 commit cd9822b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/utils/rateLimiter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const rateLimiter: RateLimitRequestHandler = rateLimit({
77
windowMs: 60 * 1000,
88
limit: (req: Request): number => {
99
logger.debug(`Rate limit check ${ req.auth ? 'authenticated' : 'anon' } - ${ req.ip }`)
10-
return req.auth ? 60 : 5 // If no auth, set lower limit
10+
return req.auth ? 60 : 5 // 60 req/min for auth, 5 for anon
1111
},
1212
keyGenerator: (req: Request): string => {
1313
return req.auth?.sub ? `session-${req.auth.sub}` : req.ip!

0 commit comments

Comments
 (0)