fix(middleware): bypass internationalization for stats and errors

This commit is contained in:
2026-02-12 18:18:51 +01:00
parent d5dd4adfe5
commit cba7c5abcf

View File

@@ -12,6 +12,16 @@ const intlMiddleware = createMiddleware({
export default function middleware(request: NextRequest) {
const { method, url, headers } = request;
const { pathname } = request.nextUrl;
// Explicit bypass for infrastructure routes to avoid locale redirects/interception
if (
pathname.startsWith('/stats') ||
pathname.startsWith('/errors') ||
pathname.startsWith('/health')
) {
return;
}
// Build header object for logging
const headerObj: Record<string, string> = {};