[WEB4LIB] Re: Automatic proxy configuration files

Glen Davies glen at rimu.cce.ac.nz
Mon Apr 12 18:05:42 EDT 1999


Hi

Depending on what you are wanting to do with the autoconfig file it 
can be more flexible if you send it to the browser via a cgi script. 
We use autoconfig files for all of our labs as they are only allowed 
full internet access during certain hours. I wrote a very simple perl 
script that detects the browser ip address and the current time. If it 
is before 7pm the auto config file that gets dished out sends them 
to a restricted proxy, if after 7pm they get sent to a proxy that 
allows full access.
The perl script just needs to print out something like the following 
to the browser. (See the urls quoted by Chuck for details on the 
syntax of this)

################################################
 print<<PACFILE;
       Content-type: application/x-ns-proxy-autoconfig \n\n

       function FindProxyForURL(url, host)
       {
       if (isPlainHostName(host) ||
       dnsDomainIs(host, ".cce.ac.nz"))
       return "DIRECT";
       else
       return "PROXY 164.45.1.3:8090; DIRECT";
       }
PACFILE

       
##########################################
> On Mon, 12 Apr 1999, Jean-Marc Edwards wrote:
> 
> > Hi,
> > 
> > I would like to know how "automatic proxy configuration" files can be 
> > created ? Can someone point me in the right direction ?
> > 
> > 
> Proxy autoconfig files for Netscape are created with a subset of 
> JavaScript commands.  Documentation can be found at:
> 
>   http://www.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html
> 
> As the Netscape Knowledge Base page at
> 
>   http://help.netscape.com/kb/client/970708-7.html
> 
> indicates, you must configure your server to send the correct MIME 
> header with the autoconfig files when a browser retrieves them.
> 
> I don't think MSIE supports these files.
> 
> Let me know if you have more questions.  I have messed around with 
> these a little bit.
> 
> Chuck
> ======================================================================
>  Chuck Bearden                                      cbearden at rice.edu
>  Electronic Resources Librarian                                   
>  Fondren Library--MS44                           713 / 527-8101 x3634
>  Rice University                                 713 / 737-5859 (fax)
>  P.O. Box 1892                                                    
>  Houston, TX 77251-1892                                           
> ======================================================================
> 




More information about the Web4lib mailing list