Skip to content

Instantly share code, notes, and snippets.

@moluapple
Created July 16, 2011 18:32
Show Gist options
  • Save moluapple/1086621 to your computer and use it in GitHub Desktop.
Save moluapple/1086621 to your computer and use it in GitHub Desktop.
proxy.pac
function FindProxyForURL(url, host) {
// If URL has no dots in host name, send traffic direct.
if (isPlainHostName(host))
return "DIRECT";
// If specific URL needs to bypass proxy, send traffic direct.
if (shExpMatch(url,"activate.adobe.com") ||
shExpMatch(url,"*dropbox.com") ||
shExpMatch(url,"*alcohol-soft.com") ||
shExpMatch(url,"*registeridm.com") ||
shExpMatch(url,"*qiyi.com*"))
return "DIRECT";
// If IP address is internal or hostname resolves to internal IP, send direct.
var resolved_ip = dnsResolve(host);
if (isInNet(resolved_ip, "10.0.0.0", "255.0.0.0") ||
isInNet(resolved_ip, "172.16.0.0", "255.240.0.0") ||
isInNet(resolved_ip, "192.168.0.0", "255.255.0.0") ||
isInNet(resolved_ip, "127.0.0.0", "255.255.255.0"))
return "DIRECT";
// All other traffic uses below proxies, in fail-over order.
return "PROXY 127.0.0.1:8087; DIRECT";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment