Just a complete shot in the dark. Have you verified that the environment
variables you set are indeed getting picked up inside of your
application? Try checking the output of os.GetEnv("HTTP_PROXY"),
os.GetEnv("HTTPS_PROXY"), and os.GetEnv("NO_PROXY"). Make sure that if
NO_PROXY is set that it isn't overriding your local proxy.
You could also try setting the lowercase versions of these env vars:
https://github.com/golang/net/blob/master/http/httpproxy/proxy.go
func FromEnvironment() *Config {
return &Config{
HTTPProxy: getEnvAny("HTTP_PROXY", "http_proxy"),
HTTPSProxy: getEnvAny("HTTPS_PROXY", "https_proxy"),
NoProxy: getEnvAny("NO_PROXY", "no_proxy"),
CGI: os.Getenv("REQUEST_METHOD") != "",
}
}
On 4/13/21 2:07 PM, Orson Cart wrote:
Please accept my ay apologies. I'd misunderstood the documentation.
I was looking for a reason why my go application's requests aren't
being sent to the proxy that I've specified using HTTP_PROXY and
HTTPS_PROXY. When I saw the comment in the documentation I thought I'd
found an explanation even if I didn't understand the reason for it
being that way.
So now I'm left with my original problem: I have HTTP_PROXY set to
http://localhost:8888 and HTTPS_PROXY set to https://localhost:8888. I
also have a proxy (Fiddler) running on localhost:8888 but requests
from my application appear to go direct, bypassing the proxy.
I'm perplexed :(
On Tuesday, 13 April 2021 at 19:17:10 UTC+1 wagner riffel wrote:
On Tue Apr 13, 2021 at 2:14 PM -03, Orson Cart wrote:
> Can anyone explain the reasoning behind this? It rather
interferes with
> debugging traffic using a local proxy like Fiddler.
>
My guess here it's for preventing the remote from tricking the
proxy to
make request to internal services that couldn't be reached otherwise.
> I've seen suggestions to define an alternative hostname in
/etc/hosts
> but as far as I can tell this doesn't work either.
>
The code you linked doesn't seen to try that hard to block loopback
requests, I do think that an /etc/hosts entry to 127.0.0.1 should
bypass the proxy, if not I don't see any other way around other than
implementing the RoundTripper yourself, which shouldn't be hard for
such simple use.
--wagner
--
You received this message because you are subscribed to the Google
Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to golang-nuts+unsubscr...@googlegroups.com
<mailto:golang-nuts+unsubscr...@googlegroups.com>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/ac6c1bae-2153-41b3-9037-110fc0eb12cfn%40googlegroups.com
<https://groups.google.com/d/msgid/golang-nuts/ac6c1bae-2153-41b3-9037-110fc0eb12cfn%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/c889bc72-0a1d-72a1-83dc-ecafe5ef8458%40gmail.com.