Repository navigation
fix(vite): route dev handlers + proxies before vite base rewrite - #4734
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
c66e896 to
d537974
Compare
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing (3)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (5)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe Vite development server now considers matching development-handler and proxy routes during explicit-route detection. New fixture tests cover asset-like requests handled by development routes, a proxy, and a Vite client asset. ChangesVite dev-handler routing
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The change is ready to merge after normal checks; no actionable routing regression was identified. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change is confined to development routing and configured proxy destinations. No introduced vulnerability was established, but protection by Vite host or origin checks cannot be assumed for requests handled earlier in the middleware chain. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Hardening Proposals
🚥 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: |
…eURL` A dev handler 404 for an asset-like request no longer falls through to the SSR renderer, and a dev handler catch-all under a non-root `baseURL` (e.g. `/app/**`) no longer swallows Vite modules.
🔗 Linked issue
❓ Type of change
📚 Description
noticed this when updating Nuxt 5 support in nuxt/fonts, where we register a dev handler under
/_nuxt/(which is the vite base).with a dev handler at
/_nuxt/probe/**,GET /_nuxt/probe/areaches the handler butGET /_nuxt/probe/a.woff2(or/_nuxt/probe/awithsec-fetch-dest: font) ends in connect's 404 page, and the handler is never called.devProxyroutes under the base behave the same way.I think this is because
nitroDevMiddlewarePreonly treatsnitro.routingmatches as explicit routes, and dev handlers and proxies aren't in there. so the request is classed as an asset and handed to vite - and vite stripsbasefromreq.url, so the route no longer matches...this PR treats dev handler and
devProxyroutes (excluding middleware and root catch-alls) as explicit, the same way explicitnitro.routingroutes are, so they reach Nitro before vite rewrites the URL.... but you may also have another better approach! 🙏
📝 Checklist