This commit is contained in:
Nông Đức Huy
2026-08-13 23:20:22 +07:00
parent 3e5d38ec18
commit 3d6b0e0d4e
145 changed files with 7817 additions and 801 deletions
+30
View File
@@ -0,0 +1,30 @@
import type { NextRequest } from 'next/server';
import createMiddleware from 'next-intl/middleware';
import { routing } from './i18n/routing';
/**
* Locale negotiation at the edge.
*
* Note the filename: Next.js 16 renamed the `middleware` convention to `proxy`.
* `middleware.ts` still works but is deprecated, so this uses the current name.
*
* Responsibilities are deliberately narrow — resolve a locale, rewrite or
* redirect, and nothing else. Proxy code runs on every request and may be
* deployed to a CDN edge, so it must not reach for the database or shared
* application state.
*/
const handleI18nRouting = createMiddleware(routing);
export function proxy(request: NextRequest) {
return handleI18nRouting(request);
}
export const config = {
/**
* Everything except API routes, Next internals and files with an extension.
* Matching static assets would add a proxy hop to every image and font for
* no benefit.
*/
matcher: '/((?!api|_next|_vercel|.*\\..*).*)',
};