下列範例顯示列在 [網域與子網域的代理伺服器] 清單中的 URL 和對應的 PAC 檔案。
如果將這些代理伺服器用於網域與子網域:
*intranet1.com proxy.intranet.com:8080
intranet2.com proxy.intranet1.com:8080
相對應的 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"; } return "NULL"; } //End of the PAC File |
如果將這些代理伺服器用於網域與子網域:
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。