From a1afeea56ba67dfceeee20b6db02a7bfd789f3cd Mon Sep 17 00:00:00 2001 From: TwinProduction Date: Tue, 6 Jul 2021 22:01:46 -0400 Subject: [PATCH] Close #126: Don't follow redirects --- client/client.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/client.go b/client/client.go index 027e0853..bf703582 100644 --- a/client/client.go +++ b/client/client.go @@ -39,6 +39,9 @@ func GetHTTPClient(insecure bool) *http.Client { InsecureSkipVerify: true, }, }, + CheckRedirect: func(req *http.Request, via []*http.Request) error { + return http.ErrUseLastResponse // Don't follow redirects + }, } } return insecureHTTPClient @@ -51,6 +54,9 @@ func GetHTTPClient(insecure bool) *http.Client { MaxIdleConnsPerHost: 20, Proxy: http.ProxyFromEnvironment, }, + CheckRedirect: func(req *http.Request, via []*http.Request) error { + return http.ErrUseLastResponse // Don't follow redirects + }, } } return secureHTTPClient