Apr 14, 2011

Proxy Autoconfig , PAC

In Browser , setting as use PAC.
http://proxycfg/browser.pac


browser.pac content is as :

function FindProxyForURL(url, host)
{
if (isPlainHostName(host) ||
shExpMatch(url, "*.mycompany.*") ||
isInNet(host, "192.168.0.0", "255.255.0.0"))
return "DIRECT";
if (isInNet(myIpAddress(), "192.168.0.0", "255.255.240.0"))
return "PROXY proxy.mycompany.com:3128; DIRECT";
else
return "PROXY proxy.othersite.com:8080; DIRECT";
}



-- Description
isPlainHostName(host) -> check if local lan server
shExpMatch(url, "*.mycompany.*") -> check url use local web site server
isInNet(host, "192.168.0.0", "255.255.0.0")) -> check server IP if in LAN
isInNet(myIpAddress(), "192.168.0.0", "255.255.240.0") -> CHeck if My IP address is in local site subnet

0 意見: