Skip to content

Commit

Permalink
Revert "Added redirect policy which takes HSTS into account, so that …
Browse files Browse the repository at this point in the history
…even if the location would go from HTTPs to HTTP it would follow to HTTPs if an HTSTS header is present"

This reverts commit c4810ff.
  • Loading branch information
skraxberger committed Aug 31, 2023
1 parent c4810ff commit 0b702c5
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions common/httpx/httpx.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,6 @@ func New(options *Options) (*HTTPX, error) {
redirectFunc = func(redirectedRequest *http.Request, previousRequests []*http.Request) error {
// add custom cookies if necessary
httpx.setCustomCookies(redirectedRequest)

location := redirectedRequest.Response.Header.Get("Location")
hsts := redirectedRequest.Response.Header.Get("Strict-Transport-Security")
url, err := redirectedRequest.URL.Parse(location)
if err != nil {
} else {
if url.Scheme == "http" && hsts != "" {
url.Scheme = "https"
}
}
redirectedRequest.URL = url
if len(previousRequests) >= options.MaxRedirects {
// https://github.com/golang/go/issues/10069
return http.ErrUseLastResponse
Expand Down

0 comments on commit 0b702c5

Please sign in to comment.