如果将这些代理用于域和子域:
intranet1.com
intranet2.com.proxy.intranet1.com:8080
internetproxy.intranet1.com:80
相应的 PAC 文件是:
// Start of the PAC File
function FindProxyForURL(url, host) {
if (dnsDomainIs(host, ".intranet1.com")) {
return "DIRECT";
}
if (dnsDomainIs(host, ".intranet2.com")) {
return "PROXY proxy.intranet1.com:8080;" +
"PROXY proxy1.intranet1.com:8080";
}
return "STARPROXY internetproxy.intranet1.com:80";
}
//End of the PAC File
|
在此情况下,如果请求 .intranet2.com 域中的主机,网关会联络 proxy.intranet1.com:8080。如果 proxy.intranet1.com:8080 停用,则请求失败。网关不进行故障转移而联络 proxy1.intranet1.com:8080。