benk2x

example PAC file

Oct 21st, 2019
1,146
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. EXAMPLE PAC FILE
  2. source:
  3. https://findproxyforurl.com/example-pac-file/
  4.  
  5.  
  6. function FindProxyForURL(url, host) {
  7.  
  8. // If the hostname matches, send direct.
  9.     if (dnsDomainIs(host, "intranet.domain.com") ||
  10.         shExpMatch(host, "(*.abcdomain.com|abcdomain.com)"))
  11.         return "DIRECT";
  12.  
  13. // If the protocol or URL matches, send direct.
  14.     if (url.substring(0, 4)=="ftp:" ||
  15.         shExpMatch(url, "http://abcdomain.com/folder/*"))
  16.         return "DIRECT";
  17.  
  18. // If the requested website is hosted within the internal network, send direct.
  19.     if (isPlainHostName(host) ||
  20.         shExpMatch(host, "*.local") ||
  21.         isInNet(dnsResolve(host), "10.0.0.0", "255.0.0.0") ||
  22.         isInNet(dnsResolve(host), "172.16.0.0""255.240.0.0") ||
  23.         isInNet(dnsResolve(host), "192.168.0.0""255.255.0.0") ||
  24.         isInNet(dnsResolve(host), "127.0.0.0", "255.255.255.0"))
  25.         return "DIRECT";
  26.  
  27. // If the IP address of the local machine is within a defined
  28. // subnet, send to a specific proxy.
  29.     if (isInNet(myIpAddress(), "10.10.5.0", "255.255.255.0"))
  30.         return "PROXY 1.2.3.4:8080";
  31.  
  32. // DEFAULT RULE: All other traffic, use below proxies, in fail-over order.
  33.     return "PROXY 4.5.6.7:8080; PROXY 7.8.9.10:8080";
  34.  
  35. }
RAW Paste Data