Pac file (proxy) problem with Firefox and Safari running on a Mac OS X

After some hours alternating between either Firefox or Safari working with my proxy configuration through a unique pac file, I finally figured out what was going on. Firefox and Safari have different syntax to use SOCKS v5.

Firefox snippet:

function FindProxyForURL(url, host) {
  if (shExpMatch(url, "foo.bar") {
    return "SOCKS5 127.0.0.1:7070";
  }
}

Safari snippet:

function FindProxyForURL(url, host) {
  if (shExpMatch(url, "foo.bar") {
    return "SOCKS 127.0.0.1:7070";
  }
}

To have both working in the same pac file:

function FindProxyForURL(url, host) {
  if (shExpMatch(url, "foo.bar") {
    return "SOCKS 127.0.0.1:7070; SOCKS5 127.0.0.1:7070";
  }
}

Tags: , , , , , ,

Comments are closed.