🔥 hotfix(proxy): matcher 排除 oauth/auth/analytics,修复登录 404#335
Merged
longsizhuo merged 1 commit intomainfrom May 6, 2026
Merged
🔥 hotfix(proxy): matcher 排除 oauth/auth/analytics,修复登录 404#335longsizhuo merged 1 commit intomainfrom
longsizhuo merged 1 commit intomainfrom
Conversation
#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|.*\..*).*)
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔥 紧急 hotfix:登录炸了
复现:访问
https://involutionhell.com/en/oauth/render/github→ 404,所有用户无法登录。根因
i18n PR (#330) 让 next-intl middleware 接管全站 locale routing。但
proxy.ts的 matcher 只排除了api/trpc/_next/_vercel/静态资源,漏掉了next.config.mjs里 rewrite 到后端的非/api/路径:/auth/:path*/auth/me、/auth/logout)/oauth/:path*/analytics/:path*请求流:
修
proxy.tsmatcher 加排除:排除后这 3 类路径不被 next-intl 拦截,直接走 next.config rewrite 到后端。
Test plan
curl -I https://<preview>/oauth/render/github应该是 302(后端 OAuth redirect 到 GitHub),不是 308 redirect 到/en/oauth/.../auth/me返回后端响应(而不是 next-intl redirect)/api/auth/callback/github→ 落地后续
加个集成测试保证 i18n routing 不再误吃 backend rewrite 路径,避免类似问题再发生。但这次优先 hotfix。