function FindProxyForURL(url, host) { // our local URLs from the domains below…
- User
function FindProxyForURL(url, host) { // our local URLs from the domains below example.com don't need a proxy: if (shExpMatch(host, "*.example.com")) { return "DIRECT"; }
// URLs within this network are accessed through // port 8080 on fastproxy.example.com: if (isInNet(host, "10.0.0.0", "255.255.248.0")) { return "PROXY fastproxy.example.com:8080"; }
// All other requests go through port 8080 of proxy.example.com. // should that fail to respond, go directly to the WWW: return "PROXY proxy.example.com:8080; DIRECT"; }
- Assistant
This function is a Proxy Auto-Configuration (PAC) script written in JavaScript. PAC scripts are used to determine whether web requests should go directly to the internet or be passed through a proxy server. Here's a breakdown of the logic in the
FindProxyForURLfunction:-
Local Domains:
- The first
ifstatement checks if thehostmatches any subdomain ofexample.comusing theshExpMatchfunction. - If the host matches
*.example.com, then the function returns"DIRECT", meaning no proxy is needed for these requests.
- The first
-
Specific Network Range:
- The second statement checks if the is within a certain IP range using the function.
-