Skip to content

Instantly share code, notes, and snippets.

@arbeitandy
Created October 17, 2012 19:36
Show Gist options
  • Save arbeitandy/3907633 to your computer and use it in GitHub Desktop.
Save arbeitandy/3907633 to your computer and use it in GitHub Desktop.
sample pacfile for work
function FindProxyForURL(url, host) {
var lhost = host.toLowerCase();
var proxy_yes = "SOCKS5 127.0.0.1:18080";
var blackhole = "PROXY 127.0.0.1:80";
var proxy_no = "DIRECT";
host = lhost;
if ((host == "locahost") ||
(shExpMatch(host, "locahost.*")) ||
(host == "127.0.0.1")) {
return proxy_no;
}
if (dnsDomainIs(host, "twitter.com") || dnsDomainIs(host, ".twitter.com") || shExpMatch(url, "twitter.com")) {
return blackhole;
} else if (dnsDomainIs(host, ".facebook.com") || shExpMatch(host, "facebook.com")) {
return blackhole;
} else if (dnsDomainIs(host, ".youtube.com") || shExpMatch(host, "youtube.com")) {
return blackhole;
} else if (dnsDomainIs(host, ".ytimg.com") || shExpMatch(host, "ytimg.com")) {
return blackhole;
} else if (dnsDomainIs(host, ".tumblr.com") || shExpMatch(host, "tumblr.com")) {
return proxy_yes;
}
return proxy_no;
}
@arbeitandy
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment