2020年8月31日星期一

Proxy Auto-Configuration (PAC) file

Proxy Auto-Configuration (PAC) file Is A Javascript Function


Sample:

function FindProxyForURL(url, host) {
  if(dnsDomainIs(host, "goup.mycompany") 
  || dnsDomainIs(host, "sub.mycompany"){
   return "PROXY  10.221.0.245:8080";
  }else if (isInNet(host, "192.168.0.0", "255.255.252.0")
          ||isInNet(host, "192.168.1.0", "255.255.255.0")
          ||isInNet(host, "10.0.108.0", "255.255.255.0") 
          ||isInNet(host, "10.2.108,0", "255.255.255.0")
          ||isInNet(host, "172.16.108,0", "255.255.255.0") 
          ||isInNet(host, "127.0.0.1", "255.255.255.255")
          ||shExpMatch(host, "*.mycorporation.com")
          ||shExpMatch(host, "local.mycomp.com")
          ||shExpMatch(host, "localhost")){
    return "DIRECT" ; //NO PROXY
  }else{
    return "PROXY 172.16.108.253:8080"; 
  }
}
The parameter of:
  • URL: is requesting destination Url.
  • Host: is the host of URL.
Ref: Proxy_Auto-Configuration_(PAC)_file

Docker/Git Proxy Setting.
HTTPS_PROXY=http://login:password@yourproxy:8080
https_proxy=http://login:password@yourproxy:8080
HTTP_PROXY=http://login:password@yourproxy:8080
http_proxy=http://login:password@yourproxy:8080

没有评论: