This commit is contained in:
2025-10-08 22:37:14 +01:00
parent 00f1814f27
commit 566993b6e8
3 changed files with 31 additions and 3 deletions
+11
View File
@@ -15,6 +15,17 @@ export default async function middleware(req: NextRequest) {
const isAuthRoute = authRoutes.includes(path);
const cookie = req.cookies.get('session')?.value;
// Debug logging for production
if (!cookie && (isProtectedRoute || isAuthRoute)) {
console.log(`No session cookie found for ${path}, headers:`, {
host: req.headers.get('host'),
'x-forwarded-proto': req.headers.get('x-forwarded-proto'),
'x-forwarded-host': req.headers.get('x-forwarded-host'),
cookies: req.headers.get('cookie')
});
}
const session = await decrypt(cookie);
// Redirect to login if accessing protected route without session