From fd834f83e4d1a3b0c9ff7800a984de0f63d10fab Mon Sep 17 00:00:00 2001 From: Andrew Jiang Date: Wed, 11 Sep 2024 19:04:05 -0400 Subject: [PATCH] fix redirects --- packages/ui/docs-bundle/src/middleware.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/ui/docs-bundle/src/middleware.ts b/packages/ui/docs-bundle/src/middleware.ts index cf469d1525..b001aa27ea 100644 --- a/packages/ui/docs-bundle/src/middleware.ts +++ b/packages/ui/docs-bundle/src/middleware.ts @@ -111,12 +111,6 @@ export const middleware: NextMiddleware = async (request) => { */ const isDynamic = isLoggedIn || hasError; - /** - * Rewrite all other requests to /static/[host]/[[...slug]] or /dynamic/[host]/[[...slug]] - */ - - nextUrl.pathname = getPageRoute(!isDynamic, xFernHost, pathname); - /** * Mock the /_next/data/... request to the corresponding page route */ @@ -158,6 +152,8 @@ export const middleware: NextMiddleware = async (request) => { /** * Rewrite all other requests to /static/[host]/[[...slug]] or /dynamic/[host]/[[...slug]] */ + + nextUrl.pathname = getPageRoute(!isDynamic, xFernHost, pathname); return NextResponse.rewrite(nextUrl, { request: { headers } }); };