Skip to content

Commit 284af32

Browse files
committed
update rate limits
1 parent a9ed0c9 commit 284af32

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

backend/src/middleware/rate-limiter.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import rateLimit from 'express-rate-limit';
22

33
// General API rate limiter - used as the default
44
export const generalLimiter = rateLimit({
5-
windowMs: 5 * 60 * 1000, // 15 minutes
5+
windowMs: 5 * 60 * 1000, // 5 minutes
66
max: 500,
77
standardHeaders: true, // Return rate limit info in the `RateLimit-*` headers
88
legacyHeaders: false, // Disable the `X-RateLimit-*` headers
@@ -11,11 +11,11 @@ export const generalLimiter = rateLimit({
1111

1212
// Auth endpoints rate limiter - more restrictive for security
1313
export const authLimiter = rateLimit({
14-
windowMs: 15 * 60 * 1000, // 15 minutes
14+
windowMs: 5 * 60 * 1000, // 5 minutes
1515
max: 50, // Limit each IP to 50 auth requests per window
1616
standardHeaders: true,
1717
legacyHeaders: false,
18-
message: 'Too many authentication attempts from this IP, please try again after 15 minutes'
18+
message: 'Too many authentication attempts, please try again after 5 minutes'
1919
});
2020

2121
// Internal/External API endpoints rate limiter - to prevent overwhelming third-party services
@@ -24,16 +24,16 @@ export const apiLimiter = rateLimit({
2424
max: 200,
2525
standardHeaders: true,
2626
legacyHeaders: false,
27-
message: 'Too many API requests from this IP, please try again after 5 minutes'
27+
message: 'Too many API requests, please try again after 5 minutes'
2828
});
2929

3030
// Health check endpoints limiter - higher limits for monitoring tools
3131
export const healthLimiter = rateLimit({
32-
windowMs: 60 * 1000, // 1 minute
33-
max: 500,
32+
windowMs: 30 * 1000,
33+
max: 1000,
3434
standardHeaders: true,
3535
legacyHeaders: false,
36-
message: 'Health check rate limit exceeded, please reduce frequency'
36+
message: 'Health check rate limit exceeded, please try again later'
3737
});
3838

3939
// Weather API specific limiter - weather APIs often have strict rate limits

0 commit comments

Comments
 (0)