fix(proxy): allow anonymous users to visit login and register (#1454)

This commit is contained in:
dancer 2026-03-13 23:25:17 +00:00 committed by GitHub
parent b4f595a68c
commit dce211e638
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,4 +1,3 @@
import { getSessionCookie } from "better-auth/cookies";
import { type NextRequest, NextResponse } from "next/server";
export function proxy(request: NextRequest) {
@ -16,14 +15,6 @@ export function proxy(request: NextRequest) {
return NextResponse.next();
}
const sessionCookie = getSessionCookie(request);
if (sessionCookie && ["/login", "/register"].includes(pathname)) {
const url = request.nextUrl.clone();
url.pathname = "/";
return NextResponse.redirect(url);
}
return NextResponse.next();
}