From 66fa66d3d30cb9428744b734083b17f41886c2f5 Mon Sep 17 00:00:00 2001 From: Strtus Date: Tue, 19 May 2026 01:11:42 +0800 Subject: [PATCH] Skip auth middleware for public proxy routes Route public paths through proxy without invoking auth so category pages no longer fail with runtime auth errors on EdgeOne. Co-authored-by: Cursor --- proxy.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/proxy.ts b/proxy.ts index 0b9c480c..7876c933 100644 --- a/proxy.ts +++ b/proxy.ts @@ -8,6 +8,7 @@ import { PATH_OG_SAMPLE, PREFIX_PHOTO, PREFIX_TAG, + isPathProtected, } from './src/app/path'; export function proxy(req: NextRequest, res:NextResponse) { @@ -33,6 +34,12 @@ export function proxy(req: NextRequest, res:NextResponse) { )); } + // Avoid invoking auth middleware on public routes so + // downstream auth runtime differences don't 500 category pages. + if (!isPathProtected(pathname)) { + return NextResponse.next(); + } + return auth( req as unknown as NextApiRequest, res as unknown as NextApiResponse,