Skip to content

Commit 8a1ed7e

Browse files
committed
fix: add /api/stats and /api/og to rate limiting middleware
- Both endpoints call fetchGitHubContributions() on every request - /api/og always bypasses cache, making every call a fresh GitHub API hit - Add /api/stats/:path* and /api/og/:path* to middleware matcher - Consistent with how /api/streak and /api/github are already protected
1 parent 9b64cab commit 8a1ed7e

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

middleware.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import { rateLimit } from './lib/rate-limit';
99
* - /api/streak
1010
* - /api/github
1111
* - /api/track-user
12+
* - /api/stats
13+
* - /api/og
1214
*
1315
* Limit: 60 requests per minute per IP.
1416
*/
@@ -52,5 +54,11 @@ export function middleware(request: NextRequest) {
5254
* Using a matcher is more efficient than checking pathnames inside the middleware.
5355
*/
5456
export const config = {
55-
matcher: ['/api/streak/:path*', '/api/github/:path*', '/api/track-user/:path*'],
57+
matcher: [
58+
'/api/streak/:path*',
59+
'/api/github/:path*',
60+
'/api/track-user/:path*',
61+
'/api/stats/:path*',
62+
'/api/og/:path*',
63+
],
5664
};

0 commit comments

Comments
 (0)