Next 13 middleware breaks page

Hi, Have some simple middleware
export const config = {
matcher: ["/((?!login).*)"]
};

export function middleware(req: NextRequest) {
if (!req.cookies.has("auth-cookie")) {
return NextResponse.rewrite(new URL("/login", req.url));
}
}
export const config = {
matcher: ["/((?!login).*)"]
};

export function middleware(req: NextRequest) {
if (!req.cookies.has("auth-cookie")) {
return NextResponse.rewrite(new URL("/login", req.url));
}
}
When used, the page is output as seen in the screenshot. Using tailwindcss, while the stylesheet appears to be in the head no styles are applied. Without the middleware pages load correctly. The 2 errors in the console for nextjs generated code are likely the issue, but all I know is my markup has no errors (works without middleware). Was unable to find any relevant info online. Anyone got an idea? Thanks.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server