Fix: HTTP proxy: return the response of a redirect, do not follow (#384)
Authored-by: Fernand Geertsema <fernand@web-iq.eu>
This commit is contained in:
@@ -15,7 +15,9 @@ func newHandler(ctx context.Context, wg *sync.WaitGroup, logger logging.Logger,
|
||||
return &handler{
|
||||
ctx: ctx,
|
||||
wg: wg,
|
||||
client: &http.Client{Timeout: httpTimeout},
|
||||
client: &http.Client{
|
||||
Timeout: httpTimeout,
|
||||
CheckRedirect: returnRedirect},
|
||||
logger: logger,
|
||||
verbose: verbose,
|
||||
stealth: stealth,
|
||||
@@ -62,3 +64,8 @@ var hopHeaders = [...]string{ //nolint:gochecknoglobals
|
||||
"Transfer-Encoding",
|
||||
"Upgrade",
|
||||
}
|
||||
|
||||
// Do not follow redirect, but directly return the redirect response.
|
||||
func returnRedirect(req *http.Request, via []*http.Request) error {
|
||||
return http.ErrUseLastResponse
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user