From 5f5cfaf7c7c794e129446a08641d69511c9e16b8 Mon Sep 17 00:00:00 2001 From: Benny Joo Date: Mon, 24 Feb 2025 11:53:06 -0500 Subject: [PATCH] perf: improve matching paths in middleware (#19491) * perf: exclude next native paths from going through middleware * fix build error * fix * fix --- apps/web/middleware.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/middleware.ts b/apps/web/middleware.ts index 34d6cc812e..8d6d69f8f2 100644 --- a/apps/web/middleware.ts +++ b/apps/web/middleware.ts @@ -16,7 +16,7 @@ const safeGet = async (key: string): Promise => { } }; -export const POST_METHODS_ALLOWED_API_ROUTES = ["/api"]; +export const POST_METHODS_ALLOWED_API_ROUTES = ["/api/"]; // trailing slash in "/api/" is actually important to block edge cases like `/api.php` // Some app routes are allowed because "revalidatePath()" is used to revalidate the cache for them export const POST_METHODS_ALLOWED_APP_ROUTES = ["/settings/my-account/general"];