From 3ab0c6a92fb36f267f80efb8ee04eefdded258bc Mon Sep 17 00:00:00 2001 From: Oscar Busk Date: Mon, 7 Nov 2022 15:48:26 +0100 Subject: [PATCH] Try to see if this fixes the various pre-loading issues. https://github.com/vercel/next.js/issues/42364#issuecomment-1300836034 --- src/middleware.ts | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/middleware.ts diff --git a/src/middleware.ts b/src/middleware.ts new file mode 100644 index 00000000..b6852a6e --- /dev/null +++ b/src/middleware.ts @@ -0,0 +1,8 @@ +import { NextResponse } from "next/server"; +import type { NextRequest } from "next/server"; + +export function middleware(request: NextRequest) { + // Temporary workaround to make navigation between app/pages work + // https://github.com/vercel/next.js/issues/42364#issuecomment-1300836034 + return NextResponse.rewrite(new URL(request.nextUrl.pathname, request.url)); +}