Use proxy like an /etc/hosts file

hostsPROXYsquid

I want a forward proxy that basically overrides DNS like /etc/hosts would on a client machine. So when People go to Google.com (for example) the proxy sends the request to a specified IP address. I assume this can be done with Squid, can someone point me in the right direction? It is only a handful of URLs that I need to manage, everything else should be passed through to the actual server.

The purpose of this is to point some groups to a UAT environment so they can test some migrated web sites, it seems easier than managing all of their hosts files. Clients are Mac, Servers are RHEL 6

Best Answer

Normally the proxy server does the resolving (at least for plain HTTP, although I'm not 100% sure about HTTPS) so you simply point your proxy to a customized DNS server. In Squid with the configuration directive dns_nameservers.

The clients need to be explicitly configured to use the proxy.

DNSmasq is relatively light weight DNS server that can use a hosts file as the configuration syntax so you do not need to configure a complete zone for each domain you'll be spoofing.

Related Topic