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

From: Richard Roderick <>
Date: Mon, 05 May 1997 17:57:07 -0700

Mark Visser has it right on. I added a few lines to mine for my own
convenience. An important note, when you do "isInNet()" Netscape has to do
a DNS lookup. During that lookup Netscape is USELESS. (Really stupid, but
it's because it is a JavaScript)

Also, on the "return proxy servername:port" line you want to add ";direct"
to the end so it reads "return proxy servername:port; direct" so in the
event your proxy server dies, they customer can still go direct.

Also again... I added the following chunk of code to the top of mine:
        serverdown = 1;
        if (serverdown) return "DIRECT";

It makes it easy for me to toggle the status of the server, so I can bring
it down later for upgrades or whatever else. (Obviously this show mine is
set to be down, as i had wanted to restart it with some new software in



At 08:57 PM 5/5/97 +0200, you wrote:
>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";
> else
> 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

 Richard A. Roderick
Received on Mon May 05 1997 - 17:59:18 MDT

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