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

From: Mark Visser <[email protected]>
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 (@warp.starnets.ro)
>
>

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.
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