Bypassing http_proxy in Golang

Viewed 4715

I have env variable set for http_proxy, but with another call, I like to bypass proxy and use direct connection to destination server instead.

Is there any way I can do that in Go lang?

Thanks.

3 Answers

I had that problem with a corporate proxy, even disabled the proxy url it was using it this was my solution

// reset proxy in http RoundTripper
var defaultTransport http.RoundTripper = &http.Transport{Proxy: nil}
client := &http.Client{Transport: defaultTransport}
Related