fix: set admin cookie path to / instead of /admin
Cookie path /admin meant the browser never sent it to /api/admin/check (the auth check endpoint), so every check returned unauthenticated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -12,7 +12,7 @@ export async function POST(request: NextRequest) {
|
||||
console.log('[AdminLogin] success, setting cookie', { secure, protocol: request.nextUrl.protocol, forwardedProto: request.headers.get('x-forwarded-proto') });
|
||||
const response = NextResponse.json({ success: true });
|
||||
response.cookies.set('admin_session', 'authenticated', {
|
||||
httpOnly: true, secure, sameSite: 'lax', path: '/admin', maxAge: 86400,
|
||||
httpOnly: true, secure, sameSite: 'lax', path: '/', maxAge: 86400,
|
||||
});
|
||||
console.log('[AdminLogin] response cookie header:', response.headers.get('set-cookie'));
|
||||
return response;
|
||||
|
||||
Reference in New Issue
Block a user