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

From: Richard Roderick <richard@dont-contact.us>
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
place.)

RIchard

 

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, "127.0.0.1", "255.255.0.0") ||
> isInNet(host, "myipdomain", "255.255.0.0"))
> return "DIRECT";
> else
> return "PROXY proxyserver:port";
>}
>
>
>For example:
>mydomain = utwente.nl
>myipdomain = 130.89.0.0
>proxyserver = proxy.student.utwente.nl
>
>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:
>http://home/netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html
>
>
>Mark
>
>-------------------------------------------------------------------------
>Mark Visser | Student Civiele Technologie & Management
>Calslaan 26 - 31 | E-mail: mark@cal026031.student.utwente.nl
>7522 MC Enschede | SNT-mail: mark@snt.student.utwente.nl
>Telephone: 053-4895038 |
>-------------------------------------------------------------------------
>Warning: You can get rid of all the bugs by disabling them from the main
menu.
>
>
>

---
 Richard A. Roderick
 richard@proaxis.com
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