Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to apply proxy settings to a particular host only (e.g., in Mac OS X. How can I do it?

In System Preferences there are only options for bypassing proxy settings for particular hosts.

share|improve this question
up vote 6 down vote accepted

You can use the following proxy.pac file to send all traffic to through the proxy while still going directly to all other hosts:

function FindProxyForURL(url, host) {

    // via proxy
    if (shExpMatch(host,"*")) {
        return PROXY;
    // Everything else directly!
    return "DIRECT";
  1. Save this script as proxy.pac(or any other name you like) on a web server. This can be a local web server (http://localhost/proxy.pac). This is required as of OSX Lion.
  2. Go to the System Preferences.
  3. Select Network.
  4. Select the network you want to change (i.e. "WiFi").
  5. Click Advanced... button.
  6. Click Proxies tab
  7. Check [x] Automatic Proxy-Configuration.
  8. In the URL: field, type in the URL to the file you've created in step 1., for example: http://localhost/proxy.pac. (note: local paths will not work in modern OSX)
  9. Click Save and Apply

Voila! Your own proxy-configuration

For more information on the format of the proxy.pac file have a look at as starting point.

share|improve this answer
Thanks, this is exactly what I was looking for. – Tushar Mathur Mar 13 '13 at 6:08

Actually you can use the file:///path/to/file scheme for the URL, instead of having to rely on a web server.

For example:

share|improve this answer
Interestingly this all works for Linux/BSD as well, and possibly even Windows; anywhere Automatic Proxy Configuration is used, this is likely to work. – jnbek May 2 at 3:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .