Last active
September 11, 2025 20:49
-
-
Save clcollins/0f46d2b75bb30e74c427ece8a7171d17 to your computer and use it in GitHub Desktop.
Proxy Conditions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Updated 2025-9-10 | |
// | |
// This proxy.pac configuration is a mirror of the other one, but sends these URLs to /dev/null | |
// for use with a "Home" profile, as opposed to a "Work" profile, to ensure they're not ever accessed. | |
// | |
// IMPORTANT - the "RAW" url for Gists changes whenever they're edited, so you must copy the new | |
// url to your Automatic Proxy Config field in Firefox. | |
// The "Reload" button will just reload the previous version of the file | |
function FindProxyForURL(url, host) { | |
// Blackhole proxy | |
var proxy = "127.0.0.1:3421" | |
// Direct connection for localhost | |
if (host == "localhost" || host == "127.0.0.1" || host == "::1") { | |
return "DIRECT"; | |
} | |
// Direct connection for private IP ranges (RFC 1918) | |
if (isInNet(host, "10.0.0.0", "255.0.0.0") || | |
isInNet(host, "172.16.0.0", "255.240.0.0") || | |
isInNet(host, "192.168.0.0", "255.255.0.0")) { | |
return "DIRECT"; | |
} | |
// Direct connection for link-local addresses | |
if (isInNet(host, "169.254.0.0", "255.255.0.0")) { | |
return "DIRECT"; | |
} | |
// Direct connection for loopback range | |
if (isInNet(host, "127.0.0.0", "255.0.0.0")) { | |
return "DIRECT"; | |
} | |
// Direct connection for local IPv6 addresses | |
if (host.indexOf("::1") != -1 || | |
host.indexOf("fe80:") == 0 || | |
host.indexOf("fc00:") == 0 || | |
host.indexOf("fd00:") == 0) { | |
return "DIRECT"; | |
} | |
// Domians to route to blackhole | |
var domains = [ | |
"amazon.com", | |
"aws.amazon.com", // Redundant but explicit | |
"console.aws.amazon.com", // Redundant but explicit | |
"amazonaws.com", | |
"awsstatic.com", | |
"elasticbeanstalk.com", | |
"redhat.com", | |
"openshiftapps.com" | |
] | |
for (var i = 0; i < domains.length; i++) { | |
if (matchesDomain(host, domains[i])) { | |
return "PROXY " + proxy; | |
} | |
} | |
// Direct connection for everything else | |
return "DIRECT"; | |
} | |
// simplifies domain matching for exact hosts or subdomains | |
function matchesDomain(host, domain) { | |
return host == domain || dnsDomainIs(host, "." + domain); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Updated 2025-9-10 | |
// | |
// IMPORTANT - the "RAW" url for Gists changes whenever they're edited, so you must copy the new | |
// url to your Automatic Proxy Config field in Firefox. | |
// The "Reload" button will just reload the previous version of the file | |
function FindProxyForURL(url, host) { | |
var proxy = "squid.corp.redhat.com:3128" | |
// Direct connection for localhost | |
if (host == "localhost" || host == "127.0.0.1" || host == "::1") { | |
return "DIRECT"; | |
} | |
// Direct connection for private IP ranges (RFC 1918) | |
if (isInNet(host, "10.0.0.0", "255.0.0.0") || | |
isInNet(host, "172.16.0.0", "255.240.0.0") || | |
isInNet(host, "192.168.0.0", "255.255.0.0")) { | |
return "DIRECT"; | |
} | |
// Direct connection for link-local addresses | |
if (isInNet(host, "169.254.0.0", "255.255.0.0")) { | |
return "DIRECT"; | |
} | |
// Direct connection for loopback range | |
if (isInNet(host, "127.0.0.0", "255.0.0.0")) { | |
return "DIRECT"; | |
} | |
// Direct connection for local IPv6 addresses | |
if (host.indexOf("::1") != -1 || | |
host.indexOf("fe80:") == 0 || | |
host.indexOf("fc00:") == 0 || | |
host.indexOf("fd00:") == 0) { | |
return "DIRECT"; | |
} | |
// Use proxy for Amazon/AWS domains | |
var domains = [ | |
"amazon.com", | |
"aws.amazon.com", // Redundant but explicit | |
"console.aws.amazon.com", // Redundant but explicit | |
"amazonaws.com", | |
"awsstatic.com", | |
"elasticbeanstalk.com" | |
] | |
for (var i = 0; i < domains.length; i++) { | |
if (matchesDomain(host, domains[i])) { | |
return "PROXY " + proxy; | |
} | |
} | |
// Direct connection for everything else | |
return "DIRECT"; | |
} | |
// simplifies domain matching for exact hosts or subdomains | |
function matchesDomain(host, domain) { | |
return host == domain || dnsDomainIs(host, "." + domain); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment