Skip to content

fix: keep the request URL when redirecting to HTTPS - #107

Open
SashaMIT wants to merge 1 commit into
unrolled:v1from
SashaMIT:fix/redirect-url-copy
Open

SashaMIT wants to merge 1 commit into
unrolled:v1from
SashaMIT:fix/redirect-url-copy

Conversation

@SashaMIT

@SashaMIT SashaMIT commented Oct 11, 2026 •

Copy link
Copy Markdown

Summary

An HTTPS redirect assigned r.URL and then changed the scheme and host. The caller still holds that request, so a later check can treat the original HTTP request as HTTPS, or keep the rewritten host. The Location header is now built from a copy, and the caller's URL stays as it arrived.

Test plan

  • go test -count=1 . passes
  • TestSSLRedirectLeavesRequestURL and TestSSLForceHostLeavesRequestURL fail on url := r.URL and pass with the copy

The redirect wrote the new scheme and host through r.URL, so the caller saw its own request rewritten. Copy the URL first.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant