I need to find a way to proxy all connections to example.com through a proxy server, it needs to work on the command line, as well as automatically within Python (much like exporting http_proxy would), but I want all other traffic to go through the network as it normally does.
Using a proxy.pac should do the trick.
with directives like
Privoxy will perform this task for you.
You can enable the HTTP_PROXY ENV as you normally would
Privoxy will handle the ACL and redirection. Check out the Forwarding section of the config.
To have it work for all programs you will need to use a transparent proxy, with firewall rules or DNS configuration to get your traffic to the proxy. I setup a Transparent Squid Proxy using Shorewall to build the firewall rules. It also run a standard proxy on the standard port which is more reliable.
To use DNS you will need to limit access to upstream servers. This will require firewall rules. However, it can be done for a single system with an entry in the
Your proxy will need to be configured to forward traffic as required. In your case it should proxy
Unless you are sure of the IP address for