From cd060999f918b0dc871423f6f3b6289bf25bce9c Mon Sep 17 00:00:00 2001 From: William Date: Wed, 11 Feb 2026 15:53:56 +0000 Subject: [PATCH] Fix middleware redirecting API routes to login page API routes have their own auth guards via guard.ts that return proper 401 JSON responses. The middleware was intercepting these requests first and redirecting them to /login, which is incorrect for API consumers. Co-Authored-By: Claude Opus 4.6 --- src/middleware.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/middleware.ts b/src/middleware.ts index 1fafa01..94ba4ce 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -7,6 +7,8 @@ function isPublicRoute(pathname: string): boolean { if (publicRoutes.includes(pathname)) return true; // /vendors/[id] is also public (browsing) if (pathname.startsWith('/vendors/')) return true; + // API routes handle their own auth via guard.ts + if (pathname.startsWith('/api/')) return true; return false; }