Skip to content

Instantly share code, notes, and snippets.

@patrickkon
Last active July 18, 2022 05:55
Show Gist options
  • Save patrickkon/9e71996f927158f98cb1495c8d4b932b to your computer and use it in GitHub Desktop.
Save patrickkon/9e71996f927158f98cb1495c8d4b932b to your computer and use it in GitHub Desktop.
proxy.pac
var FindProxyForURL = function(init, profiles) {
return function(url, host) {
"use strict";
var result = init, scheme = url.substr(0, url.indexOf(":"));
do {
result = profiles[result];
if (typeof result === "function") result = result(url, host, scheme);
} while (typeof result !== "string" || result.charCodeAt(0) === 43);
return result;
};
}("+test", {
"+test": function(url, host, scheme) {
"use strict";
if (/^127\.0\.0\.1$/.test(host) || /^::1$/.test(host) || /^localhost$/.test(host)) return "DIRECT";
return "HTTPS localhost:8081"; // This line matters
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment