Normally firefox and other browsers allow users to set an exclusive list in which proxy won't apply to the specified domain names or ip addresses? My question is that how to do it other way around to specify only the domains to let the proxy to apply to?


If you want to configure the browsers of multiple machines in a standard way, just about all popular browsers support the proxy auto-config file. This allows you to have an arbitrarily complex set of rules for whether to use a proxy and which one to use, and means you solve the problem for all popular browsers.

An example proxy.pac that could meet your described requirements:

// proxy.pac: Proxy Auto-Configuration file.

function FindProxyForURL( url, host ) {

    var proxy_spec = "proxy.localnet:3128";

    // Default to using no proxy.
    var ProxyConfig = "DIRECT";

        dnsDomainIs( host, ".foo.example.org" ) ||
        dnsDomainIs( host, ".bar.example.com" ) ||
        dnsDomainIs( host, ".baz.example.net" )
    ) {
        // Requested domain matches, let's use the proxy.
        ProxyConfig = "PROXY " + proxy_spec;
    } // end if

    return ProxyConfig;

} // end FindProxyForURL()
| improve this answer | |

Check out FoxyProxy there is an option to add in proxies and use them on a certain set of domains.

| improve this answer | |

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.