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 <cursoragent@cursor.com>
This commit is contained in:
parent
6a01efce18
commit
66fa66d3d3
7
proxy.ts
7
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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user