Refactor authentication and session management: remove debug logging and streamline session verification

This commit is contained in:
2025-10-08 23:00:44 +01:00
parent 72410be343
commit 429649191b
3 changed files with 7 additions and 53 deletions
-11
View File
@@ -15,17 +15,6 @@ 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