4

I am behind a very capricious proxy (squid) and it seems only http requests made with a particular user-agent are allowed.

When fetching google.com from Google Chrome, I can see a HTTP GET on WireSharc. However, wget tries to resolve the DNS first through the default DNS servers which never answer.

How can I make wget or even git use the proxy instead of a direct DNS query?

  • If you're seeing that DNS requests are never answered, why do you think it's the fault of the proxy? Please edit your question to clarify. – roaima Mar 11 '16 at 11:33
  • 1
    @roaima I never said it is the proxy's fault. I said wget is not doing the name resolution through the proxy. – nowox Mar 11 '16 at 11:48
  • Please could you clarify the relevance of "it seems only http requests made with a particular user-agent are allowed" to the DNS lookup issue you're describing. I don't see the connection. Thanks. – roaima Mar 11 '16 at 13:45
  • if wget is still doing a DNS lookup for the target site (not the proxy) then it's not set to use a proxy. You could resolve the lookup problem with a hosts file entry, but that will just push the problem to the next stage, if it doesn't make a proper proxy request to the proxy, it will be rejected then. – Adrien Jul 22 '16 at 23:43
3

How can I make wget or even git use the proxy instead of a direct DNS query?

Set the proxy environment variable and it will do this straight up:

export http_proxy='http://proxy.contoso.com:3128/'
wget http://www.example.net/
| improve this answer | |
  • I already did it. From chrome I get a HTTP REQUEST and from wget I still get a TCP request to the DNS. So Chrome is just asking the proxy and wget tries to resolve the DNS first. – nowox Mar 11 '16 at 13:46
  • @nowox I don't get any DNS lookup from wget in this configuration. What platform (OS) are you using? – roaima Mar 11 '16 at 15:49
1

there is no mechanism to specify that the proxy should try a particular IP address for a particular host. You could change the URL from, say, http://example.com/mypage to http://33.33.33.33/mypage, but then the proxy server won't know the hostname to request. The modern web (HTTP/1.1) depends on a Host header always being present in a request, allowing one web server to serve multiple sites identified by their hostname.

Your best bet would be to configure the proxy server to use the DNS resolver of your choice. This would only be possible if you use a local proxy server that you control.

Resource - https://askubuntu.com/questions/447877/how-to-resolve-the-dns-locally-when-there-is-a-proxy-configured

| improve this answer | |
  • So how is it possible that Chrome does not make a query to the DNS itself? – nowox Mar 11 '16 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.