-
-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathmiddleware.ts
More file actions
25 lines (23 loc) · 876 Bytes
/
middleware.ts
File metadata and controls
25 lines (23 loc) · 876 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
import createMiddleware from "next-intl/middleware"
import { routing } from "./app/i18n/routing"
export default createMiddleware(routing)
export const config = {
// 优化匹配器以减少 Edge Middleware 调用
// 排除静态资源、API 路由、已缓存的路径等
matcher: [
/*
* Match all request paths except for the ones starting with:
* - api (API routes)
* - love (love page)
* - blog (blog pages)
* - privacy (privacy page)
* - tags (tags pages)
* - _next/static (static files)
* - _next/image (image optimization files)
* - _vercel (Vercel internal)
* - favicon.ico, robots.txt, sitemap.xml (static files)
* - files with extensions (images, fonts, etc.)
*/
"/((?!api|love|blog|terms|privacy|tags|_next/static|_next/image|_vercel|favicon.ico|robots.txt|sitemap.xml|.*\\..*).*)",
],
}