Commit 09a2f4c
committed
fix(proxy): matcher 排除 oauth/auth/analytics,修复登录 404
#330 i18n PR 让 next-intl middleware 接管全站 locale routing,但
matcher 只排除了 api/trpc/_next/_vercel/静态资源,没排除 next.config.mjs
的 rewrites 直通后端的路径。现象:
- 用户访问 /oauth/render/github
- next-intl middleware 308 redirect 到 /en/oauth/render/github
(按 cookie / Accept-Language 推断 locale)
- next.config rewrite source 是 /oauth/:path* 不带 locale,不匹配
- 落到 app/[locale]/oauth/... 但这个 page 不存在 → 404
- 登录炸
3 条 rewrite-to-backend 路径都要排:
- /auth/:path* NextAuth-like (/auth/me, /auth/logout)
- /oauth/:path* OAuth 跳转入口(登录关键)
- /analytics/:path* 埋点
加进 matcher 排除组:
/((?!api|trpc|auth|oauth|analytics|_next|_vercel|.*\..*).*)1 parent 2425d9a commit 09a2f4c
1 file changed
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
86 | 90 | | |
87 | 91 | | |
88 | | - | |
| 92 | + | |
89 | 93 | | |
0 commit comments