Skip to content

Instantly share code, notes, and snippets.

@kmayer
Created March 9, 2010 00:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmayer/326016 to your computer and use it in GitHub Desktop.
Save kmayer/326016 to your computer and use it in GitHub Desktop.
/etc/proxy.pac
// Matches all hosts that start with "local."
// The funky regex matches the port number (if include in the URL)
function FindProxyForURL(url, host) {
if (shExpMatch(host,"local.*")) {
port = url.match( /\w+:\/\/[^:]+(:\d+)\// );
if (port) {
return "PROXY localhost" + port[1];
} else {
return "PROXY localhost";
}
}
return "DIRECT";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment