MacOS – Safari Web proxy

macosPROXYsafari

I have a question about setting proxies in Safari for the Mac. In Network preferences one can configure a Web proxy – HTTP, which has the field: "Bypass proxy settings for these Hosts&Domains". Is there a way to bypass any host or domain, but apply proxy only to one specific host?

EDIT: Found a good link about that – http://nscsysop.hypermart.net/proxypac.html

Best Answer

You should not use the Web proxy, but to use the Automatic Proxy Configuration, and setup a .pac file. In this file, you specify which domain/hosts you want the proxy.

Check wiki, http://en.wikipedia.org/wiki/Proxy_auto-config, for more information.

A sample may looks like:

function FindProxyForURL(url, host) 
{
  PROXY = "PROXY 127.0.0.1:8000";
  DEFAULT = "DIRECT";

  var domain_list = [
    "blahblahblah.com"
  ];

  for (var i = domain_list.length - 1; i >= 0; i--){
    if (dnsDomainIs(host,domain_list[i])) {return PROXY}
  };
}

The other simple way is to use the Firefox, and install an extension, Autoproxy.