From f4b92bc8d03fb6905a9057cacef7d9be1fe6ca46 Mon Sep 17 00:00:00 2001 From: Bryan Robitaille Date: Thu, 20 Jun 2024 12:33:45 -0400 Subject: [PATCH] fix: Add file extention check into single middleware matcher. (#3870) --- middleware.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/middleware.ts b/middleware.ts index 65666b8ac6..9715054e98 100644 --- a/middleware.ts +++ b/middleware.ts @@ -64,20 +64,17 @@ const { auth } = NextAuth({ }); export const config = { - matcher: [ - //Match all request paths except for ones that reference files with a file extension - "/((?!.*\\.[^/]+?$).*)", - /* + /* Match all request paths except for the ones starting with: - _next/static (static files) - _next/image (image optimization files) - img (public image files) - static (public static files) - react_devtools (React DevTools) + - contain files with extentions */ - - "/((?!_next/static|_next/image|img|static|react_devtools|unsupported-browser|javascript-disabled|__nextjs_).*)", - ], + matcher: + "/((?!_next/static|_next/image|img|static|react_devtools|unsupported-browser|javascript-disabled|__nextjs_|.*\\.[^/]+?$).*)", }; // TOMORROW