fix(i18n): add next-intl middleware for locale routing
Some checks failed
Workflow / ⚫️ Test (push) Has been cancelled
Workflow / ʦ TypeScript (push) Has been cancelled

The middleware was deleted in the Next.js 16 upgrade but is still required
by next-intl to handle locale detection and URL rewriting. Without it,
/auth/sign-in can't resolve to [locale=de]/auth/sign-in → 404.

Uses createMiddleware from next-intl/middleware with the shared routing config.
This commit is contained in:
Zaid Marzguioui
2026-03-31 22:47:55 +02:00
parent e263bd93f8
commit 4450776826
2 changed files with 16 additions and 1 deletions

View File

@@ -4,7 +4,7 @@ WORKDIR /app
# --- Install + Build in one stage ---
FROM base AS builder
ARG CACHE_BUST=3
ARG CACHE_BUST=4
COPY . .
RUN pnpm install --no-frozen-lockfile
ENV NEXT_TELEMETRY_DISABLED=1

15
apps/web/middleware.ts Normal file
View File

@@ -0,0 +1,15 @@
import createMiddleware from 'next-intl/middleware';
import { routing } from '@kit/i18n/routing';
export default createMiddleware(routing);
export const config = {
matcher: [
// Match all pathnames except:
// - API routes (/api/...)
// - Next.js internals (/_next/...)
// - Static files with extensions
'/((?!api|_next|.*\\..*).*)',
],
};