appropriate proxy server for connect to web site. PAC file contains a
java script function “FindProxyForURL(url, host)” . This function
returns one or more access method specifications. This
function allows to define simple and complex rules to find the proxy
server for given URL. That rule can be defined by the
Protocol or Specific host or Specific Port. So user can
define different proxies to different URLs.
Examples:
Proxy1.pac:
function FindProxyForURL(url, host)
{
/* SPECIAL CASES FOR NON-BALANCED ROUTING */
// Direct connections to non-FQDN hosts
if (isPlainHostName(host) ||
(host == "127.0.0.1") ||
(host == "www.pcs-computing.com") ||
(host == "pcs-computing.com") ||
(shExpMatch(host, "*.pcs-intranet.com")) ||
(shExpMatch(host, "90.0.0.*")) ||
(shExpMatch(host, "10.*"))) {
return "DIRECT" /* Directly connect to site */
} else {
/* Go through Proxy Server */
return "PROXY pcsproxy.pcs-computing.com:8080" }
}Proxy2.pac:function FindProxyForURL(url, host) {
/* our local URLs from the domains below example.com don't need a proxy: */
if (shExpMatch(host, "*.example.com"))
{
return "DIRECT";
}
// URLs within this network are accessed through
// port 8080 on fastproxy.example.com:
if (isInNet(host, "10.0.0.0", "255.255.248.0"))
{
return "PROXY fastproxy.example.com:8080";
}
// All other requests go through port 8080 of proxy.example.com.
// should that fail to respond, go directly to the WWW:
return "PROXY proxy.example.com:8080; DIRECT";
}Set PAC file path in Mozilla FireFox,
Information Source : http://en.wikipedia.org/wiki/Proxy_auto-config



0 comments:
Post a Comment