fix(dev): proxy subpaths for devProxy rules - #4481
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughDev proxy route handling now normalizes configured prefixes, forwards requests with the matched base removed, restores the original pathname, and adds integration coverage for exact, wildcard, trailing-slash, nested, query-string, and non-matching routes. ChangesDev proxy routing
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
commit: |
| }); | ||
|
|
||
| it("should proxy nested subpaths with a query string", async () => { | ||
| expect(await req("/proxy/foo/bar?x=1")).toMatchObject({ |
There was a problem hiding this comment.
I think this is a correct (breaking change) that /proxy matches /proxy while /proxy/** anything nested nitro v2 behavior was consequence of following connect middleware
There was a problem hiding this comment.
so we should tell people to set /proxy/** when they intend to proxy all subpaths?
🔗 Linked issue
❓ Type of change
📚 Description
noticed this when trying to reproduce a bug on nuxt/cli:
on v2 a single
devProxyrule proxies the whole prefix, but on v3 only the exact route (and its trailing-slash form) is proxied; every subpath falls through to the app.hitting
/proxyworks with v2 (target sees '/') and v3 (target sees '/proxy') but in v3 hitting/proxy/foo/bar?x=1doesn't work - it 404s...this is an attempt to resolve but you may have a different approach - or maybe you want to move into routerules (?)
📝 Checklist