Instead of set an proxy server unconditionally via *_PROXY environment variables and exclude certain host names via NO_PROXY environment variable, let's reverse the semantic by defining a new environment variable PROXY_SELECTOR which points to an executable that is passed a URI as first argument and will return on stdout:
- "NO_PROXY" -> if no proxy should get used for the input URI
- a comma separated list of URLs in the *_PROXY environment variable format, e.g.: "http://proxy.example.com:8080" or if multiple proxies are eligible for the given input URI: "http://proxy.example.com:8080,http://proxy2.example.com:8080"
Above proposal will enable a more flexible proxy configuration in complex setups and by reversing the semantic, allow explicit proxy configuration of only know URIs.