Use multiple proxies on Firefox

  • Create pac file proxy.pac with content:

    function FindProxyForURL(url, host) {
    	var proxy1 = "PROXY 1st.proxy.com:port";  // <-- Update here
    	var proxy2 = "PROXY 2nd.proxy.com:port";  // <-- Update here
    	var no_proxy = "DIRECT";
    
    	var proxy2_hosts = ["*example.com"];            // <-- Update here
    	var no_proxy_hosts = ["127.0.0.1","localhost"]; // <-- Update here
    
    	for (i = 0; i < no_proxy_hosts.length; i++) {
    		if (shExpMatch(host, no_proxy_hosts[i])) return no_proxy;
    	}
    
    	for (i = 0; i < proxy2_hosts.length; i++) {
    		if (shExpMatch(host, proxy2_hosts[i])) return proxy2;
    	}
    
    	return proxy1;
    }
    
  • Open Firefox Preferences -> Network Settings.

  • Check Automatic proxy configuration URL.

  • Set file path to proxy.pac: file:///path/to/proxy.pac

  • Reload.

  • OK.

See also

comments powered by Disqus