next.js
d2fe7545 - Fix static Go route rewrites in adapter deployments (#102589)

Commit
1 day ago
Fix static Go route rewrites in adapter deployments (#102589) ### What? Static `route.go` handlers can serve adapter rewrites when `x-matched-path` names the selected route and the forwarded URL still has its original pathname. The handler sees the pathname and query the adapter forwarded. ### Why? Vercel can rewrite `/go-alias` to `/api/go/100` and invoke the correct Go function with `/go-alias` still in the URL. The Go wrapper returned 404 before calling the static handler. A static `route.ts` handler accepts that routing decision without matching the pathname again. ### How? Keep handler selection on `x-matched-path` and allow the original pathname for static adapter outputs. Dynamic outputs still use the destination pathname to resolve parameters. This keeps the existing dynamic and self-hosted behavior. Follow-up to #101985. ### Verification - Focused Turbopack dev tests for Go parameter decoding and rewritten URLs. - Focused Turbopack production tests for the adapter, shared worker, and rewritten URLs. - TypeScript, Prettier, ESLint, Go and Rust formatting. - This patch was not redeployed to the hosted smoke project. <!-- NEXT_JS_LLM --> --------- Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
Author
Parents
Loading