-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
net/http: provide better error message when proxy is misconfigured #29809
Comments
/cc @bcmills for cmd/go. |
More detail, please.
|
With variables as below;
The error is;
With variables as;
The below succeeds Not sure about your point on HTTP only. The |
What happens if you run |
Works fine when variables are set to;
|
@jtfogarty, sorry for the delay here. I was actively ignoring cmd/go issues, the cmd/go owners deal with them, but since you asked me about this at GCP Next I'm taking a look. There's a difference between:
and
The former proxies https requests (e.g. those from cmd/go get) using CONNECT requests to an https proxy server at the given ip:port. The latter proxies those https requests still using CONNECT requests but to an http proxy server at the given ip:port. The notable difference is that you almost certainly don't have a valid https certificate for your proxy server if you're connecting via an IP address and not via a hostname. There are a few rare exceptions (like https://1.1.1.1/) but generally IP addresses don't get TLS certs, and only hostnames do. Admittedly the error message above kinda sucks:
It looks like your proxy is immediately hanging up on you (cmd/go) when it's not presented any SNI value (a hostname) in the TLS ClientHello. I get a slightly better error if I use a dummy IP address for a proxy:
There at least I see ( But perhaps we could detect this case (an https proxy without a hostname) and upgrade the error message to something more helpful with a hint ("you need a hostname probably") along with the original error. Can you confirm that's your issue? |
Hi @bradfitz We are connecting via a hostname. Sorry for the confusion. |
Maybe your proxy doesn't listen on https. What does curl say when you do |
This is only an issue for apps written in go. I was installing a server with helm today. I was able to execute the following |
What does curl say when you do |
Not sure what ip:port you want me to curl to but if I curl to github.com with the
Using the ip for github
|
So I bet the issue here is that Go just can't validate your I'm afraid I can't really debug further by talking in the abstract. I'd need more verbose logs that you'd inevitably need to redact too much to be useful. If you want to privately email me the full details, I'm bradfitz at golang.org. |
This ended up being an environment configuration problem. User had:
Where
Go could perhaps provide a better error message than |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Doing a
go get
fails behind a corporate proxy if environment variables are set as below;HTTP_PROXY=http://proxyIp:proxyPort
it succeeds if set as
HTTP_PROXY=proxyIp:proxyPort
this is true for HTTP or HTTPS variables This is also true for any go project using net/http
I'm seeing this issue with Docker versions greater than 17.09, Jenkins-x, goBuffalo
Older versions of go (specifically 1.8.3 - the only version I tested) do not behave this way
Docker version 17.09 and lower do not behave this way.
What did you expect to see?
I expect it to pull through the proxy server with the below environment variables set;
HTTP_PROXY=http://proxyIp:proxyPort
HTTPS_PROXY=https://proxyIp:proxyPort
What did you see instead?
Process fails to get through the proxy.
The text was updated successfully, but these errors were encountered: