website refactor
This commit is contained in:
@@ -26,12 +26,6 @@ export async function middleware(request: NextRequest) {
|
||||
cookiePreview: cookieHeader.substring(0, 100) + (cookieHeader.length > 100 ? '...' : '')
|
||||
});
|
||||
|
||||
// Handle /sponsor root redirect (preserves cookies)
|
||||
if (pathname === '/sponsor') {
|
||||
logger.info('[MIDDLEWARE] Redirecting /sponsor → /sponsor/dashboard');
|
||||
return NextResponse.redirect(new URL('/sponsor/dashboard', request.url));
|
||||
}
|
||||
|
||||
// Set x-pathname header for layout-level protection
|
||||
const response = NextResponse.next();
|
||||
response.headers.set('x-pathname', pathname);
|
||||
@@ -101,6 +95,13 @@ export async function middleware(request: NextRequest) {
|
||||
return redirectResponse;
|
||||
}
|
||||
|
||||
// Handle /sponsor root redirect (preserves cookies)
|
||||
// Only reached if authenticated and allowed
|
||||
if (pathname === '/sponsor') {
|
||||
logger.info('[MIDDLEWARE] Redirecting /sponsor → /sponsor/dashboard');
|
||||
return NextResponse.redirect(new URL('/sponsor/dashboard', request.url));
|
||||
}
|
||||
|
||||
// All checks passed
|
||||
logger.info('[MIDDLEWARE] ALLOWING ACCESS', { pathname });
|
||||
logger.info('[MIDDLEWARE] ========== REQUEST END (ALLOW) ==========');
|
||||
|
||||
Reference in New Issue
Block a user