On Wed, 2008-01-23 at 11:48 -0700, Joe Lewis wrote: > Ralf Mattes wrote: > > On Wed, 2008-01-23 at 11:12 -0700, Joe Lewis wrote: > > > >> Giovanni Donelli wrote: > >> > >>> I am trying to make Apache follow the same rules as the browser > >>> > >>> > >> Realize that the browser doesn't get the configurations for each website > >> it visits, it only configures, then runs using the same configuration > >> for every website. > >> > > > > Realize that, since a .pac file is a ECMA-Script program, that > > configuration can (and often will) be dynamic. The proxy needs to be > > determined for each request. > > > > > >> That means it should be easy to create a simple module that has a single > >> configuration directive that points to the next proxy in the chain, > >> something like > >> > >> WPADConfiguration http://secondproxyserver.example.com/my-proxy-file.pac > >> > >> And then just configure mod_proxy, mod_proxy_http, and create a handler > >> that prefaces all URL's with the proxy: string, set the proxyreq setting > >> in the request_rec to an appropriate value, and return 1 to allow > >> mod_proxy to handle the rest of it. > >> > > > > No - that's too simple. The module needs to run the JS function for each > > request and has to be able to dynamically set the proxy. > > > > Indeed - I had completely forgotten about that. Isn't there a > javascript library could be connected into, or should the module be > written in perl to use that? I suppose parsing the file manually would > work. But I don't like reinventing wheels.
There _IS_ a library (C and python(?) interface) - downloadable from the google code link posted in the first message ... trivial to link into an Apache module. AFAIK it uses the mozilla JS code. Cheers, RalfD > Joe