From 4450776826dcc2ac83164e1dbdf84a48e561b0ce Mon Sep 17 00:00:00 2001 From: Zaid Marzguioui Date: Tue, 31 Mar 2026 22:47:55 +0200 Subject: [PATCH] fix(i18n): add next-intl middleware for locale routing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- Dockerfile | 2 +- apps/web/middleware.ts | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 apps/web/middleware.ts diff --git a/Dockerfile b/Dockerfile index 0e87096d2..7eb92fcc9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/apps/web/middleware.ts b/apps/web/middleware.ts new file mode 100644 index 000000000..1e1fff1de --- /dev/null +++ b/apps/web/middleware.ts @@ -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|.*\\..*).*)', + ], +};