Sun Java System Portal Server Secure Remote Access 7.2 管理指南

PAC 文件用法示例

以下示例显示在“域和子域代理”列表中列出的 URL 及相应的 PAC 文件。

返回 DIRECT 或 NULL 的示例

如果将这些代理用于域和子域:

*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

返回 STARPROXY 的示例

如果将这些代理用于域和子域:

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