Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

We are about to start using a proxy.pac file in our environment. It will be a very simple file with most traffic going to the proxy but a handfull of sites going direct (where they are hosted internally etc).

We have a couple of sites that need adding to go direct, but only on specific ports. By this i mean - Through Proxy - Go direct

Anyone able to suggest how I do this, as I cant even get it to work with the in url option.


share|improve this question
up vote 1 down vote accepted

This seems to work fine for me:

function FindProxyForURL(url, host) {

    if ( shExpMatch(url, "*") ) { return "DIRECT"; }

    return "PROXY proxy:port";

BTW, you can use alert() for debugging, at least under IE. It's crappy, but it at least gets you some insight into what the script is doing. Obviously, remove them before going into production.

share|improve this answer

Why not set up an internal proxy to proxy etc with a virtualhost and add that to the proxy.pac ?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.