Skip to content

Instantly share code, notes, and snippets.

@mub
Created November 19, 2012 03:30
Show Gist options
  • Save mub/4108790 to your computer and use it in GitHub Desktop.
Save mub/4108790 to your computer and use it in GitHub Desktop.
Browsers trail
/*
Proxy Auto-Config file, see http://en.wikipedia.org/wiki/Proxy_auto-config
This would work with most browsers and more, do not need any heavy plugins with this script and it's more powerful, flexible and maintainable than
any of plugins. Instead of clicking through menus, just point to this file anywhere in your FS.
*/
function FindProxyForURL(url, host) {
/* example with using regex:
var regexpr = /[a-zA-Z]{4}.microsoft.com/;
if(regexpr.test(host)) { ...
*/
if ((host == "localhost") || (shExpMatch(host, "localhost.*")) || (host == "127.0.0.1")) { return "DIRECT"; }
if (shExpMatch(host, "that*One*cluster.vip.acme.com")) {
// do not use alerts with Opera, alerts here crash the browser
// alert("Going That clusters Proxy");
return "PROXY that-clusters.vip.acme.com:1234";
}
// URLs within this network are accessed through
else if (isInNet(myIpAddress(), "10.0.0.0", "255.255.248.0")) {
// should this proxy fail to respond, go directly to the www:
return "PROXY intranet-proxy.acme.com:12345; DIRECT";
}
else return "DIRECT";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment