Re: Q) How to write "Automatic Proxy Cfg." script ?

From: Mark Visser <>
Date: Mon, 5 May 1997 20:57:08 +0200 (MET DST)

On Mon, 5 May 1997, Penisoara Adrian wrote:

> Hi!
> I use Squid Cache (1.1.9) and I would like to know how can I set up
> a script for NNavigator and IExplorer's "Automatic Proxy Configuration"
> feature. Some links to specific documentation, FAQs, etc. are welcomed.
> Thank you very much.
> PS: I have an httpd daemon (Apache) on the machine I'm running Squid.
> I believe I already seen smth. related to this, a Java script ?
> Ady (

Try this:

in apache's srm.conf add:

# For proxy config
AddType application/x-ns-proxy-autoconfig .pac

and in mime.types add:
application/x-ns-proxy-autoconfig pac

Then make a file proxy.pac with in it:

// Automatic Proxy Configuration File
// Last update: 19970505
// Location: http://wwwserver/proxy.pac

function FindProxyForURL(url, host)
    if (isPlainHostName(host))
                return "DIRECT";
    else if (dnsDomainIs(host, "mydomain"))
                return "DIRECT";
    else if (dnsDomainIs(host, "localhost"))
                return "DIRECT";
    else if (dnsDomainIs(host, "mydomain") ||
             isInNet(host, "", "") ||
             isInNet(host, "myipdomain", ""))
                 return "DIRECT";
        return "PROXY proxyserver:port";

For example:
mydomain =
myipdomain =
proxyserver =

This script defines that if the computer of which a page is requested is
in mydomain or myipdomain it will go direct to a WWW page (not use proxy)
and for every other page we will go through the proxy.

If proxy is unavailable go direct.

Further reading:


Mark Visser | Student Civiele Technologie & Management
Calslaan 26 - 31 | E-mail:
7522 MC Enschede | SNT-mail:
Telephone: 053-4895038 |
Warning: You can get rid of all the bugs by disabling them from the main menu.
Received on Mon May 05 1997 - 11:58:10 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:35:07 MST