How to resolve the DNS locally when there is a proxy configured?

If I configure the proxy, under Settings -> Network -> Proxy, and then try to access "http://google.com", the name resolution (IP of google.com) will happen there, at the proxy server but...

How can I change this behavior?

I mean, I need to resolve the DNS locally at my Desktop, BEFORE hitting the proxy.

But why?

This way, I'll configure "ignore-hosts with lots of subnets (IPv4 / IPv6), that don't need the proxy to reach them", then, Ubuntu first needs to:

1- Resolve the DNS locally (i.e. not via proxy too);

2- Try to match the locally discovered website IP with "ignore-hosts" settings;

Is it possible?

Tks! Thiago


This isn't possible when you use an HTTP proxy because:

  • The server you connect to is that of the proxy, not of the ultimate destination.
  • You send the full URL (including hostname) of your request to the proxy. The proxy then does the request on your behalf.

Therefore, it must be the proxy that does the DNS lookup.

It isn't possible to do the DNS lookup locally, and send only the IP address to the proxy server. Firstly, 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 which hostname to request, an importanta part of the modern web (HTTP/1.1 and later), which depends on a Host header always being present in a request, removing the restriction that all hostnames be served from different IP addresses.

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.

Note: When you use a SOCKS proxy or another lower-level tunnelling method, you can use a local DNS server. Just not with an HTTP proxy.