Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 14s
Build & Deploy / 🏗️ Build (push) Failing after 5m6s
Build & Deploy / 🧪 QA (push) Failing after 5m22s
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 4s
Nightly QA / call-qa-workflow (push) Failing after 33s
36 lines
931 B
TypeScript
36 lines
931 B
TypeScript
import { NextResponse } from "next/server";
|
|
import type { NextRequest } from "next/server";
|
|
import createMiddleware from "next-intl/middleware";
|
|
|
|
const intlMiddleware = createMiddleware({
|
|
// A list of all locales that are supported
|
|
locales: ["de"],
|
|
|
|
// Used when no locale matches
|
|
defaultLocale: "de",
|
|
|
|
// Use default locale without prefix
|
|
localePrefix: "as-needed",
|
|
});
|
|
|
|
export default function middleware(request: NextRequest) {
|
|
const { pathname } = request.nextUrl;
|
|
|
|
// Explicit bypass for analytics and error tracking paths
|
|
if (pathname.startsWith("/stats") || pathname.startsWith("/errors")) {
|
|
return NextResponse.next();
|
|
}
|
|
|
|
return intlMiddleware(request);
|
|
}
|
|
|
|
export const config = {
|
|
// Matcher for all pages and internationalized pathnames
|
|
// excluding api, _next, static files, etc.
|
|
matcher: [
|
|
"/((?!api|admin|stats|errors|_next|_vercel|.*\\..*).*)",
|
|
"/",
|
|
"/(de)/:path*",
|
|
],
|
|
};
|