Skip to content

Instantly share code, notes, and snippets.

@jjtroberts
Last active December 6, 2024 22:30
Show Gist options
  • Select an option

  • Save jjtroberts/14c3746dd71867b440d69ab300cd014e to your computer and use it in GitHub Desktop.

Select an option

Save jjtroberts/14c3746dd71867b440d69ab300cd014e to your computer and use it in GitHub Desktop.
function FindProxyForURL(url, host) {
// List of domains for which the proxy should be used
var proxyDomains = [
"windowsupdate.microsoft.com",
"*.windowsupdate.microsoft.com",
"*.update.microsoft.com",
"*.windowsupdate.com",
"download.windowsupdate.com",
"download.microsoft.com",
"*.download.windowsupdate.com",
"wustat.windows.com",
"ntservicepack.microsoft.com",
"go.microsoft.com",
"dl.delivery.mp.microsoft.com",
"*.delivery.mp.microsoft.com"
];
// Define the proxy server
var proxy = "PROXY 10.2.0.61:443"; // Replace with your proxy address and port
// Check if the host matches any of the domains
for (var i = 0; i < proxyDomains.length; i++) {
if (shExpMatch(host, proxyDomains[i])) {
return proxy;
}
}
// Default to direct connection
return "DIRECT";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment