.PAC File Example


Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /homepages/40/d806441738/htdocs/clickandbuilds/edwardsd/work/wp-content/plugins/wp-syntax/wp-syntax.php on line 383

Basic PAC file configuration. The browser can be configured to point to this file (proxy.pac) in order to direct the browser traffic to the correct Gateway Proxy server. The path can be configured to use a public URL such as http://proxy.domain.com/_proxy/proxy.pac.

Internet Explorer -> Tools -> Internet Options -> Connections -> LAN Settings -> Automatic Configuration -> Use Automatic configuration script

http://support.microsoft.com/kb/135982

// Notes in this section
// This is a PAC file which allows I.E. (or Firefox) to direct the traffic to the correct Proxy server. 
 
function FindProxyForURL(url, host)
{
/*
Internal IP address ranges:
192.168.1.0 -London
192.168.2.0 -Paris
192.168.3.0 -New York
*/
 
if
(
host == "localhost"
||
shExpMatch(host, "localhost.*")
||
isPlainHostName(host)
||
isInNet(host, "127.0.0.0", "255.0.0.0")
||
isInNet(host, "192.168.1.0", "255.255.255.0")
||
isInNet(host, "192.168.2.0", "255.255.255.0")
||
isInNet(host, "192.168.3.0", "255.255.255.0")
)
{
return "DIRECT";
}
 
/*
Proxy exceptions comment section, you can list 
URLs which require proxy exceptions/bypass here.
- NoProxyBankingSite1.co.uk
- NoProxyBankingSite2.co.uk
- 10.10.10.10
*/
(
dnsDomainIs(host, "NoProxyBankingSite1.co.uk")
||
dnsDomainIs(host, "NoProxyBankingSite2.co.uk")
||
shExpMatch(url, "*10.10.10.10*")
)
{
return "DIRECT";
}
 
if (isInNet(myIpAddress(),"192.168.1.0","255.255.255.0"))
{
return "PROXY 192.168.1.253:8080";
}
if (isInNet(myIpAddress(),"192.168.2.0","255.255.255.0"))
{
return "PROXY 192.168.2.253:8080";
}
 
return "DIRECT";
}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.