Repository navigation
fix: preserve trailing slash when proxying root path to a sub-path target - #137
Conversation
📝 WalkthroughWalkthroughThe ChangesTrailing slash handling in joinURL
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
/
/
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #137 +/- ##
=======================================
Coverage 94.91% 94.91%
=======================================
Files 8 8
Lines 786 786
Branches 320 319 -1
=======================================
Hits 746 746
Misses 35 35
Partials 5 5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Reverts #137 to restore the pre-fix path behavior, since downstream consumers (http-proxy-middleware v4, webpack-dev-server, @rspack/dev-server) rely on `joinURL("/api", "/")` returning `"/api"` rather than `"/api/"`. Adds a regression test guarding `setupOutgoing` so the previous behavior stays locked in.
Closes #134. The
path === "/"early-return dropped the slash sojoinURL("/maildev", "/")returned"/maildev"instead of"/maildev/", causing redirect loops with sub-path-mounted upstreams. Treat root-path as a real path and let the trailing/leading slash logic produce the correct join. Per @pi0 in #134 ("PR welcome!").Summary by CodeRabbit
Bug Fixes
Tests