1

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

http://www.test.com - Through Proxy http://www.test.com:765 - Go direct

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

Thanks

3 Answers 3

3

This seems to work fine for me:

function FindProxyForURL(url, host) {

    if ( shExpMatch(url, "http://www.test.com:765/*") ) { 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.

1

If you want something more generic, to allow all requests that require a non-standard port to go direct, try:

if (shExpMatch(url, "*://" + host + ":*"))
    return "DIRECT";

It's not perfect (and you might want to modify so that requests that explicitly specify the standard port for the protocol e.g. :80 for HTTP, and :443 for HTTPS still go via the proxy) but it should catch most requests. Refinements welcome.

-1

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

You must log in to answer this question.

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