https://groups.google.com/forum/#!topic/golang-nuts/OwGvopYXpwE
As seen in this thread, when http.Client
sends requests to redirects, the header gets reset.
There is a workaround like:
client.CheckRedirect = func(req *http.Request, via []*http.Request) error {
if len(via) >= 10 {
return fmt.Errorf("too many redirects")
}
if len(via) == 0 {
return nil
}
for attr, val := range via[0].Header {
if _, ok := req.Header[attr]; !ok {
req.Header[attr] = val
}
}
return nil
}
But my question is how do I do this if I want to http Request through my proxy server.
When http request goes through proxy server, does header get all reset? Do I have to set up another http.Client
in proxy?
I set up my proxy server using https://github.com/elazarl/goproxy
Thanks,