Middleware not working
Unanswered
Cape lion posted this in #help-forum
Cape lionOP
I have a simple middleware inside my
But I don't know why, as you can see from the screen it's messing with my login page. Those 15 error are coming from just 1 page load.
Any clue?
middleware.ts
that works like thisexport default async function middleware(request: NextRequest) {
const sessionString = request.cookies.get('session')?.value
if (!sessionString) {
return NextResponse.redirect(new URL("/login", request.url));
}
const parsedData: SessionData = JSON.parse(sessionString);
await extendSession(parsedData);
return NextResponse.next();
}
export const config = {
matcher: '/((?!login).*)', //Match every route except for /login
}
But I don't know why, as you can see from the screen it's messing with my login page. Those 15 error are coming from just 1 page load.
Any clue?