From 5ffa1e1255c3d6cc01d21ce4a38c8f0e19ad10e7 Mon Sep 17 00:00:00 2001 From: khabzox Date: Thu, 29 Aug 2024 14:08:08 +0100 Subject: [PATCH] fix middleware --- apps/nextjs-app/middleware.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/apps/nextjs-app/middleware.js b/apps/nextjs-app/middleware.js index b8028e3..59e74fc 100644 --- a/apps/nextjs-app/middleware.js +++ b/apps/nextjs-app/middleware.js @@ -12,26 +12,21 @@ const isPublicRoute = createRouteMatcher([ ]); const isPublicApi = createRouteMatcher([ - "/api(.*)", "/api/tutorial(.*)", "/api/search(.*)", - ]); export default clerkMiddleware((auth, req) => { if (isPublicRoute(req) || isPublicApi(req)) { - console.log("Public Route or API accessed:", req.url); - return; // Allow access without authentication + return; } - console.log("Private Route accessed:", req.url); - auth().protect(); // Require authentication + auth().protect(); }); export const config = { matcher: [ "/((?!_next|[^?]*\\.(?:html?|css|js(?!on)|jpe?g|webp|png|gif|svg|ttf|woff2?|ico|csv|docx?|xlsx?|zip|webmanifest)).*)", - "/", "/(api|trpc)(.*)", ], };