Skip to content

Commit 6704d10

Browse files
authored
Merge pull request #335 from InvolutionHell/hotfix/login-oauth-locale-bypass
🔥 hotfix(proxy): matcher 排除 oauth/auth/analytics,修复登录 404
2 parents 2425d9a + 09a2f4c commit 6704d10

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

proxy.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ export function proxy(req: NextRequest) {
8383
export const config = {
8484
// Match all pathnames except for
8585
// - api / trpc:API 路由不进 i18n(无 UI,纯 fetch)
86+
// - auth / oauth / analytics:next.config rewrites 直通后端的路径
87+
// (登录 / OAuth / 埋点)。被 next-intl 加了 locale 前缀后,
88+
// rewrite source(/oauth/:path*)不匹配带 locale 的版本(/en/oauth/...),
89+
// 落到 [locale]/oauth/... 404。所以必须排除掉,让请求直接走 rewrite。
8690
// - _next / _vercel:Next.js 内部
8791
// - .*\..*:任何带 . 的路径(静态资源 / sitemap.xml / robots.txt 等)
88-
matcher: "/((?!api|trpc|_next|_vercel|.*\\..*).*)",
92+
matcher: "/((?!api|trpc|auth|oauth|analytics|_next|_vercel|.*\\..*).*)",
8993
};

0 commit comments

Comments
 (0)