Skip to content

Instantly share code, notes, and snippets.

@robot56
Last active January 20, 2018 22:30
Show Gist options
  • Save robot56/d30a4bc1a8e0374b140d3981c6419e4e to your computer and use it in GitHub Desktop.
Save robot56/d30a4bc1a8e0374b140d3981c6419e4e to your computer and use it in GitHub Desktop.
function FindProxyForURL(url, host) {
// Localhost, Intranet, DMZ and Private networks
if (shExpMatch(host, "localhost")) {
return "DIRECT";
}
if (shExpMatch(host, "127.0.0.1")) {
return "DIRECT";
}
if (shExpMatch(url, "ftp://*")) {
return "DIRECT";
}
if (shExpMatch(url, "http://10.*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://10.*")) {
return "DIRECT";
}
if (shExpMatch(url, "http://165.155.*")) {
return "DIRECT";
}
if (shExpMatch(url, "http://207.127*")) {
return "DIRECT";
}
if (shExpMatch(url, "http://205.232.145*")) {
return "DIRECT";
}
// Intranet and DMZ hosts
if (dnsDomainIs(host, ".nycnet")) {
return "DIRECT";
}
if (dnsDomainIs(host, "www.nycboe.net")) {
return "PROXY proxy:8002; PROXY filtr.nycboe.org:8002";
}
if (dnsDomainIs(host, "portal.nycboe.net")) {
return "PROXY proxy:8002; PROXY filtr.nycboe.org:8002";
}
if (dnsDomainIs(host, "aws.moodle.nycboe.net")) {
return "PROXY proxy:8002; PROXY filtr.nycboe.org:8002";
}
if (dnsDomainIs(host, "successmaker.nycboe.net")) {
return "PROXY proxy:8002; PROXY filtr.nycboe.org:8002";
}
if (dnsDomainIs(host, "schools.nyc.gov")) {
return "DIRECT";
}
if (dnsDomainIs(host, ".nycboe.org")) {
return "DIRECT";
}
if (dnsDomainIs(host, ".nycboe.net")) {
return "DIRECT";
}
if (dnsDomainIs(host, ".nycenet.edu")) {
return "DIRECT";
}
if (dnsDomainIs(host, ".vc.central.nyced.org")) {
return "DIRECT";
}
// DMZ and Extranet Partners
if (dnsDomainIs(host, ".opt-osfns.org")) {
return "DIRECT";
}
if (dnsDomainIs(host, ".psal.org")) {
return "DIRECT";
}
if (shExpMatch(url, "http://psal.org*")) {
return "DIRECT";
}
if (shExpMatch(url, "http://opt-osfns.org*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://opt-osfns.org*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://a816*.nyc.gov*")) {
return "DIRECT";
}
if (dnsDomainIs(host, "search.namequery.com")) {
return "PROXY filtr.nycboe.org:8002";
}
// Office365
if (shExpMatch(url, "https://*.aadrm.com*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.activedirectory.windowsazure.com*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.appex.bing.com*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.appex-rf.msn.com*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.assets-yammer.com*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.azurerms.com*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.cloudapp.net*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.cloudfront.net*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.crocodoc.com*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.entrust.net*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.geotrust.com*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*auth.gfx.ms*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*ajax.googleapis.com*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.live.com*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.d.docs.live.net*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.Lync.com*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.microsoft.com*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.microsoftonline.com*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.microsoftonlineimages.com*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.microsoftonline-p.com*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.msecnd.net*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.msocdn.com*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.office.com*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.office.net*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.office365.com*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.omniroot.com*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.onenote.com*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.onmicrosoft.com*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.outlook.com*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.phonefactor.net*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.public-trust.com*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*appexsin.stb.s-msn.com*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.sharepoint.com*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.sharepointonline.com*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.symcb.com*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*ms.tific.com*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.verisign.com*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*m.webtrends.com*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.windows.net*")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.yammer.com**")) {
return "DIRECT";
}
if (shExpMatch(url, "https://*.yammerusercontent.com*")) {
return "DIRECT";
}
// ignore proxy on secure sites -- this allows us to use the DOE proxy on HTTP requests while unblocking secure sites
if (shExpMatch(url, "https://*")) {
return "DIRECT";
}
// BEGIN TUNNELED EXEMPTIONS
// These URLs go through our own proxy to bypass the NYCDOE proxy
var bypassProxy = "PROXY 45.55.72.162:3128"; // HTTPS (NYC)
if (shExpMatch(url, "http://*.imgur.com*") || shExpMatch(url, "http://imgur.com*")
|| shExpMatch(url,"http://*.gamepedia.com")) {
return bypassProxy;
}
// END TUNNELED EXEMPTIONS
// Everything else (default)
return "PROXY proxy:8002; PROXY filtr.nycboe.org:8002;";
}
function FindProxyForURL(url,host) {
{
// Localhost, Intranet, DMZ and Private networks
if ( shExpMatch(host, "localhost") ) { return "DIRECT"; }
if ( shExpMatch(host, "127.0.0.1") ) { return "DIRECT"; }
if ( shExpMatch(url, "ftp://*") ) { return "DIRECT"; }
if ( shExpMatch(url, "http://10.*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://10.*") ) { return "DIRECT"; }
if ( shExpMatch(url, "http://165.155.*") ) { return "DIRECT"; }
if ( shExpMatch(url, "http://207.127*") ) { return "DIRECT"; }
if ( shExpMatch(url, "http://205.232.145*") ) { return "DIRECT"; }
// Intranet and DMZ hosts
if ( dnsDomainIs(host, ".nycnet") ) { return "DIRECT"; }
if ( dnsDomainIs(host, "www.nycboe.net") ) { return "PROXY proxy:8002; PROXY filtr.nycboe.org:8002"; }
if ( dnsDomainIs(host, "portal.nycboe.net") ) { return "PROXY proxy:8002; PROXY filtr.nycboe.org:8002"; }
if ( dnsDomainIs(host, "aws.moodle.nycboe.net") ) { return "PROXY proxy:8002; PROXY filtr.nycboe.org:8002"; }
if ( dnsDomainIs(host, "successmaker.nycboe.net") ) { return "PROXY proxy:8002; PROXY filtr.nycboe.org:8002"; }
if ( dnsDomainIs(host, "schools.nyc.gov") ) { return "DIRECT"; }
if ( dnsDomainIs(host, ".nycboe.org") ) { return "DIRECT"; }
if ( dnsDomainIs(host, ".nycboe.net") ) { return "DIRECT"; }
if ( dnsDomainIs(host, ".nycenet.edu") ) { return "DIRECT"; }
if ( dnsDomainIs(host, ".vc.central.nyced.org") ) { return "DIRECT"; }
// DMZ and Extranet Partners
if ( dnsDomainIs(host, ".opt-osfns.org") ) { return "DIRECT"; }
if ( dnsDomainIs(host, ".psal.org") ) { return "DIRECT"; }
if ( shExpMatch(url, "http://psal.org*") ) { return "DIRECT"; }
if ( shExpMatch(url, "http://opt-osfns.org*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://opt-osfns.org*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://a816*.nyc.gov*") ) { return "DIRECT"; }
if ( dnsDomainIs(host, "search.namequery.com") ) { return "PROXY filtr.nycboe.org:8002"; }
// Office365
if ( shExpMatch(url, "https://*.aadrm.com*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.activedirectory.windowsazure.com*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.appex.bing.com*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.appex-rf.msn.com*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.assets-yammer.com*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.azurerms.com*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.cloudapp.net*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.cloudfront.net*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.crocodoc.com*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.entrust.net*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.geotrust.com*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*auth.gfx.ms*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*ajax.googleapis.com*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.live.com*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.d.docs.live.net*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.Lync.com*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.microsoft.com*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.microsoftonline.com*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.microsoftonlineimages.com*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.microsoftonline-p.com*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.msecnd.net*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.msocdn.com*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.office.com*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.office.net*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.office365.com*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.omniroot.com*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.onenote.com*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.onmicrosoft.com*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.outlook.com*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.phonefactor.net*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.public-trust.com*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*appexsin.stb.s-msn.com*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.sharepoint.com*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.sharepointonline.com*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.symcb.com*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*ms.tific.com*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.verisign.com*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*m.webtrends.com*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.windows.net*") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.yammer.com**") ) { return "DIRECT"; }
if ( shExpMatch(url, "https://*.yammerusercontent.com*") ) { return "DIRECT"; }
// ignore proxy on secure sites -- this allows us to use the DOE proxy on HTTP requests while unblocking secure sites
if ( shExpMatch(url, "https://*") ) { return "DIRECT"; }
// Everything else (default)
return "PROXY proxy:8002; PROXY filtr.nycboe.org:8002;" } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment