From 0b702c571364eed9b54d3c39be7e85fd3889502d Mon Sep 17 00:00:00 2001 From: Stefan Kraxberger Date: Thu, 31 Aug 2023 10:44:09 +0200 Subject: [PATCH] Revert "Added redirect policy which takes HSTS into account, so that even if the location would go from HTTPs to HTTP it would follow to HTTPs if an HTSTS header is present" This reverts commit c4810ffbb7629f56f4cad52dc8a57cfe7d5ef57c. --- common/httpx/httpx.go | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/common/httpx/httpx.go b/common/httpx/httpx.go index 109a28032..6d3ee165f 100644 --- a/common/httpx/httpx.go +++ b/common/httpx/httpx.go @@ -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