-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproxy.ts
More file actions
29 lines (27 loc) · 943 Bytes
/
proxy.ts
File metadata and controls
29 lines (27 loc) · 943 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import createMiddleware from "next-intl/middleware";
import { routing } from "@/i18n/routing";
/**
* Next.js 16 Proxy (formerly `middleware.ts` — renamed in Next.js 16).
*
* next-intl handles:
* - Locale detection from Accept-Language header and cookies
* - Redirecting `/` → `/en` (or the user's preferred locale)
* - Setting the NEXT_LOCALE cookie for subsequent requests
*
* The matcher excludes static assets, API routes, and Next.js internals
* so they are never locale-prefixed.
*/
export default createMiddleware(routing);
export const config = {
matcher: [
/*
* Match all request paths EXCEPT:
* - _next/static (Next.js static assets)
* - _next/image (Next.js image optimisation)
* - favicon.ico (browser favicon requests)
* - Files with an extension (e.g. .svg, .png, .js, .css)
* - api routes
*/
"/((?!api|_next/static|_next/image|favicon\\.ico|.*\\..*).*)",
],
};