fix french homepage
Build & Deploy / Build & Push Docker Image (push) Failing after 49s
Build & Deploy / Deploy to VPS (push) Has been skipped
Test / API Unit Tests (push) Failing after 5m6s
Test / Marketplace Unit Tests (push) Has been cancelled
Test / Admin Unit Tests (push) Has been cancelled
Test / Dashboard Unit Tests (push) Has been cancelled
Test / API Integration Tests (push) Has been cancelled
Build & Deploy / Build & Push Docker Image (push) Failing after 49s
Build & Deploy / Deploy to VPS (push) Has been skipped
Test / API Unit Tests (push) Failing after 5m6s
Test / Marketplace Unit Tests (push) Has been cancelled
Test / Admin Unit Tests (push) Has been cancelled
Test / Dashboard Unit Tests (push) Has been cancelled
Test / API Integration Tests (push) Has been cancelled
This commit is contained in:
@@ -44,6 +44,19 @@ export function proxy(request: NextRequest): NextResponse {
|
||||
return applySecurityHeaders(response, csp);
|
||||
}
|
||||
|
||||
// Redirect locale-less paths (e.g. /sign-in → /en/sign-in), but not /dashboard, /admin, or files
|
||||
const firstSegment = request.nextUrl.pathname.split('/')[1];
|
||||
const isFile = /\.\w+$/.test(request.nextUrl.pathname);
|
||||
if (firstSegment && !isFile && !isLocale(firstSegment) && firstSegment !== 'dashboard' && firstSegment !== 'admin') {
|
||||
const cookieLocale = request.cookies.get(localeCookie)?.value;
|
||||
const locale = isLocale(cookieLocale)
|
||||
? cookieLocale
|
||||
: localeFromAcceptLanguage(request.headers.get('accept-language')) || defaultLocale;
|
||||
const destination = request.nextUrl.clone();
|
||||
destination.pathname = `/${locale}${request.nextUrl.pathname}`;
|
||||
return applySecurityHeaders(NextResponse.redirect(destination), csp);
|
||||
}
|
||||
|
||||
const response = NextResponse.next({ request: { headers: requestHeaders } });
|
||||
const explicitLocale = request.nextUrl.pathname.split('/')[1];
|
||||
if (isLocale(explicitLocale)) {
|
||||
|
||||
Reference in New Issue
Block a user