Skip to content
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

HTTP contacts proxy when asked to get localhost URL despite this making no sense and no_proxy envvar forbids it #746

Closed
dlakelan opened this issue Aug 31, 2021 · 2 comments · Fixed by #833
Labels
client About our HTTP client

Comments

@dlakelan
Copy link

Julia 1.7.0-beta4
HTTP.jl 0.9.13

When using WGLMakie it uses HTTP to attempt to access a URL that points to the localhost 127.0.0.1, HTTP decides to request this URL through the proxy. It seems to me HTTP should never contact a proxy for a request pointing at the localhost (either the name "localhost" or any ipv4 in "127.0.0.0/8" or the Ipv6 "::1" ). However it should especially not do this because I have listed 127.0.0.0/8 in the no_proxy and NO_PROXY environment variables:

julia> scatter(rand(4))
Error showing value of type Makie.FigureAxisPlot:
ERROR: HTTP.ExceptionRequest.StatusError(503, "GET", "http://127.0.0.1:9284/assetserver/65c7b14432db03331e0c19fc9cc39592adb2b936-JSServe.js", HTTP.Messages.Response:
"""
HTTP/1.1 503 Service Unavailable
Server: squid/4.12
Mime-Version: 1.0
Date: Sun, 29 Aug 2021 18:02:26 GMT
Content-Type: text/html;charset=utf-8
Content-Length: 3786
X-Squid-Error: ERR_CONNECT_FAIL 111
Vary: Accept-Language
Content-Language: en

Here are the relevant environment variables:

no_proxy=127.0.0.0/8,localhost, lan, 10.79.1.0/24, fd56:9122:70e4:1::/64
https_proxy=http://aldproxy.lan:3128
NO_PROXY=127.0.0.0/8,localhost, lan, 10.79.1.0/24, fd56:9122:70e4:1::/64
HTTPS_PROXY=http://aldproxy.lan:3128
HTTP_PROXY=http://aldproxy.lan:3128
http_proxy=http://aldproxy.lan:3128
@quinnj
Copy link
Member

quinnj commented May 26, 2022

Sorry for the slow response here, but here's what I can tell is happening:

  • Your no_proxy variable is actually "127.0.0.0/8", which doesn't match the host in the request that was sent ("127.0.0.1"); obviously they're very close and both refer to local loopback addresses, but currently the proxy check is fairly simple and relies on either exact host matching or at least a "dot suffix" match (e.g. noproxy=.google.com will match gmail.google.com)

It does seem from looking around that you never want to proxy localhost requests, so I'm proposing in a forthcoming PR that we ignore proxying when the request host is some form of localhost.

@quinnj
Copy link
Member

quinnj commented May 26, 2022

Fixed in #833

@quinnj quinnj closed this as completed May 26, 2022
@fonsp fonsp linked a pull request Jun 8, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client About our HTTP client
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants