// ******************************************************************** // roaming2-pac.pac: Version 1.0 // // Proxy Auto-Config (PAC) template file for web browser and roaming // agent users. Follow the instructions throughout this configuration // file in order to update for your specific environment. // // Notes: // - "host" refers to the host portion of the URL being requested (i.e. // everything after the :// at the beginning of the URL up to the // first colon (:) or slash (/) (e.g. www.example.com). // - "url" refers to the entire URL being requested. This includes // the protocol and file (e.g. http://www.example.com/index.html). // - Microsoft IE processes the PAC file once per hostname and caches // the result. You cannot have different behaviour for the same // hostname (e.g. http://www.example.com/index.html must be // directed to the same proxy as http://www.example.com/foo.html). // - isInNet will perform a DNS lookup for non IP addresses. Ensure the // host is a raw IP before using this function. // - For debugging, set the debug variable to true. // ******************************************************************** function FindProxyForURL(url, host) { //******************************************************************* // CUSTOMIZATION SECTION // All changes to customize this PAC file for your environment should // appear in this section. // If a section does not apply to you, you can remove it by placing a // '//' at the beginning of each line in the section // 1) Listening port for the roaming agent. // * This must match the entry in your roaming // agent's agentconfigure.xml file // * The default value is 80 // var ROAMING_AGENT_LISTENING_PORT = "80"; // 2) Bypassed URLs // * Define entries for URLs that should not be accessed // through the WSS service. // * Examples include: // - URLs on your company intranet // * You many optionally include URLs that you consider // safe // * The '*' character may be used as a wildcard. // var BYPASS_LIST = [ "*.download.microsoft.com", "*.windowsupdate.com", "*.windowsupdate.microsoft.com", "windowsupdate.microsoft.com", "*.update.microsoft.com", "update.microsoft.com" ]; // 3) On-LAN Web Gateways // * This section can be used to define secondary proxies // that can be used in the event that the roaming agent // software fails. // * If the roaming agent is not functional, the browser // will be directed to the proxies listed below. Note // that this may cause traffic to be backhauled through // a VPN when off the company LAN. // // * Define entries for each CSP or web gateway in your // corporate LAN(s) // * Use the format proxy_hostname_or_ip_address:port // e.g. // mycsp.intranet.mycompany.com:3128 // OR // 10.1.2.1:80 // var WEB_GATEWAYS = [ "myproxy:3128", "myotherproxy:3129" ]; // END OF CUSTOMIZATION SECTION - do not edit below this point // **************************************************************** var debug = false; var debug_string = ""; var direct = "DIRECT"; var proxy_string = "PROXY localhost:"+ROAMING_AGENT_LISTENING_PORT; if ((typeof WEB_GATEWAYS) != "undefined") { var i=0; while (i < WEB_GATEWAYS.length) { proxy_string += "; PROXY " + WEB_GATEWAYS[i]; i++; } } proxy_string = proxy_string + "; DIRECT"; if (debug) debug_string += "PAC:\nProxy string is: " + proxy_string + "\n"; // If the host is this computer, connect directly if ((host == "localhost") || (host == "localhost.localdomain") || (host == "127.0.0.1")) { if (debug) { debug_string += "Host is local, using " + direct; alert(debug_string); } return direct; } // If host name is local (i.e. contains no dots), connect directly. if (isPlainHostName(host)) { if (debug) { debug_string += "Host contains no dots, using " + direct; alert(debug_string); } return direct; } // If host name is part of the IANA private IP address ranges, connect // directly. if (/^\d+\.\d+\.\d+\.\d+$/.test(host) && (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"))) { if (debug) { debug_string += "Host is IANA private IP, using " + direct; alert(debug_string); } return direct; } // ***************************************************************** // Specify remote URLs that are trusted and don't require proxying // and should be bypassed when roaming. // ***************************************************************** if ((typeof BYPASS_LIST) != "undefined") { var i=0; while (i < BYPASS_LIST.length) { if (shExpMatch(host, BYPASS_LIST[i])) { if (debug) { debug_string += "Host matches bypass entry: "; debug_string += BYPASS_LIST[i] + "\nGoing direct"; alert(debug_string); } return direct; } i++; } if (debug) debug_string += "No matching bypass\n"; } else { if (debug) debug_string += "No bypass list specified\n"; } if (debug) { debug_string += "Using proxy string"; alert (debug_string); } return proxy_string; }