Skip to content

Commit 5074f15

Browse files
committed
feat: rate limiting separate rules
1 parent 90dadef commit 5074f15

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/middleware/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ import { checkRateLimit, setRateLimitCookie } from '../services/rateLimiter';
44

55
// Define rate limit configurations: path -> seconds
66
const RATE_LIMIT_CONFIG: { [path: string]: number } = {
7-
'/api/auth': 10, // Default existing behavior: 10 seconds for /api/auth and its sub-routes
8-
// Add other specific path configurations here, e.g.:
9-
// '/api/heavy-operation': 60,
7+
'/api/auth/login': 10,
8+
'/api/auth/logout': 10,
9+
'/api/auth/signup': 60,
10+
'/api/auth/reset-password': 60,
11+
'/api/auth/update-password': 60,
1012
};
1113

1214
const rateLimiter = defineMiddleware(async ({ cookies, url }, next) => {

0 commit comments

Comments
 (0)