Repository navigation
fix: retain relative protocol in redirect location header - #156
Conversation
|
Warning Review limit reached
Next review available in: 46 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughModifies ChangesProtocol-relative redirect rewriting
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 #156 +/- ##
=======================================
Coverage 94.95% 94.96%
=======================================
Files 8 8
Lines 793 794 +1
Branches 328 330 +2
=======================================
+ Hits 753 754 +1
Misses 35 35
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Document that redirect rewriting only applies to same-host Location headers and that protocol-relative Location values stay protocol-relative after rewriting, making protocolRewrite a no-op for them. Add a regression test covering the protocolRewrite + protocol-relative case. Co-Authored-By: Claude Opus 4.8 <[email protected]>
A protocol-relative `Location` (`//host`) stays protocol-relative only when the host alone is rewritten (hostRewrite/autoRewrite). When the operator explicitly sets `protocolRewrite`, that is a deliberate opt-in to a concrete scheme (often a downgrade-prevention control), so it now absolutizes the URL to the chosen protocol instead of being silently ignored. Updates the ported node-http-proxy#1298 tests accordingly and documents the interaction in README and AGENTS. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Part of #2.
The original bug http-party/node-http-proxy#1298 does not exist in
httpxy. They use Node.js legacy URL parsing, but we already use WHATWG URL. So, unlikenode-http-proxy, wehttpxydo not break anything here.However, the test case exposes a different nit: because we are using WHATWG URL, after we serialize the destination (
u.toString()), we producehttp://ext-manual.com/instead of retaining the relative protocol//ext-manual.com/.The PR fixes this nit.
Summary by CodeRabbit
Summary by CodeRabbit
Locationheaders (//host/path) so they remain protocol-relative after applying rewrite options.