More Configuration Details _ _ _
INDEX BACK NEXT _ _ _

Advanced client configuration
Firstly: as with the previous section on client configuration, A lot of this is taken from the FAQ, so I will be happy to list you in the credits section if you contributed this.

This section covers what is known as Auto-Configuration of the client. This function of some browsers is very useful in certain cases. With it you can do things like:

The client machines download the script when they startup from a web server. This web server has to serve the file as a different mime-type. The Auto-Config script is normally a .pac file, so if you aren't already using this for something else you should put the mime type in your mime config file for your web server.

In apache (for example) put the following in your mime.types file

application/x-ns-proxy-autoconfig pac

Two clients currently allow Auto-Configuration, Netscape and Internet Explorer 3.02. Bear in mind that this java script is run for each URL that the browser connects to (The client has to decide if it should connect to any given URL directly or via the cache - so if you connect to your intranet it does a different thing to if you connect to a site on the outside This can slow down the browser if you do things like DNS lookups, which can take a while and thus add a delay to each URL the person goes to.


Netscape 3

Select Network Preferences from the Options menu. On the Proxies page, click the radio button next to Automatic Proxy Configuration and then fill in the URL for your JavaScript proxy configuration file in the text box. The box is normally too small, but the text will scroll to the right as you go. Here is a screen shot of the Netscape Navigator automatic proxy configuration screen. You may also wish to consult Netscape's documentation for the Navigator JavaScript proxy configuration system, here


Internet Explorer

Bear in mind that only the later versions of Internet Explorer support this function. You may have to upgrade to get the followin menus.

Select Options from the View menu. Click on the Advanced tab. In the lower left-hand corner, click on the Automatic Configuration button. Fill in the URL for your JavaScript file in the dialog box it presents you. Then exit MSIE and restart it for the changes to take effect. MSIE will reload the JavaScript file every time it starts. (Netscape has a Reload buttion that you can press to get it to update).


The Java Script

Here is a sample auto configuration JavaScript:

//We (www.is.co.za) run a central cache for our customers that they //access through a firewall - thus if they want to connect to their intranet //system (or anything in their domain at all) they have to connect //directly - hence all the "fiddling" to see if they are trying to connect //to their local domain. //Replace each occurrence of company.com with your domain name //and if you have some kind of intranet system, make sure //that you put it's name in place of "internal" below. //We also assume that your cache is called "cache.company.com", and //that it runs on port 8080. Change it down at the bottom. function FindProxyForURL(url, host) { //If they have only specified a hostname, go directly. if (isPlainHostName(host)) return "DIRECT"; //These connect directly if the machine they are trying to //connect to starts with "intranet" - ie http://intranet //Connect directly if it is intranet.* //If you have another machine that you want them to //access directly, replace "internal*" with that //machine's name if (shExpMatch( host, "intranet*")|| shExpMatch(host, "internal*")) return "DIRECT"; //Connect directly to our domains (NB for Important News) if (dnsDomainIs( host,"company.com")|| //If you have another domain that you wish to connect to //directly, put it in here dnsDomainIs(host,"sistercompany.com")) return "DIRECT"; //So the error message "no such host" will appear through the //normal Netscape box - less support queries :) if (!isResolvable(host)) return "DIRECT"; //We only cache http, ftp and gopher if (url.substring(0, 5) == "http:" || url.substring(0, 4) == "ftp:"|| url.substring(0, 7) == "gopher:") //Change the ":8080" to the port that your cache //runs on, and "cache.company.com" to the machine that //you run the cache on return "PROXY cache.company.com:8080; DIRECT"; //We don't cache WAIS if (url.substring(0, 5) == "wais:") return "DIRECT"; else return "DIRECT"; }

You should copy the above script to a directory on a web server in a place that is easy to remember, http://www.mycompany.com/cache.pac might be a good place.


The Squid Users guide is copyright Oskar Pearson oskar@is.co.za

If you like the layout (I do), I can only thank William Mee and hope he forgives me for stealing it