httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Lewis <...@joe-lewis.com>
Subject Re: mod_proxy chaining with a .pac file
Date Wed, 23 Jan 2008 18:12:56 GMT
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.

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.

Joe


> On Jan 23, 2008 2:34 PM, Joe Lewis <joe@joe-lewis.com> wrote:
>
>   
>> Giovanni Donelli wrote:
>>     
>>> Take this pac file:
>>> $ curl http://wpad.wws.lan/wpad.dat
>>> function FindProxyForURL(url, host)
>>> {
>>>     // simple hostname
>>>     if (dnsDomainLevels(host) == 0) {return "DIRECT";}
>>>
>>>     // match Host against local domains (w/ optional :port)
>>>     var dom = /(127\.\d+\.\d+\.\d+|\.wws\.lan\.?|\.local\.?)(:\d+)?/;
>>>     if(dom.test(host)) { return "DIRECT"; }
>>>
>>>     // All other requests go through port 8080 of proxy
>>>     // should that fail to respond, go direct:
>>>     return "PROXY proxy.wws.lan:8080; DIRECT";
>>> }
>>>
>>> Obviously the browser needs to evaluate the URL each time it wants to
>>>       
>> make
>>     
>>> an http request. So I want to do that in my proxy.
>>>
>>> Currently proxy chaning in mod_proxy supports only say:
>>> ProxyRemote * x.y.z.w
>>>
>>> Now not having found mod_proxy can help me in that, I thought about
>>>       
>> writing
>>     
>>> a mod that in apache would interpret a pac file. In my configuration,
>>>       
>> the
>>     
>>> browser can not be aware of the pac file, only my proxy.
>>>
>>> I tried to explain you what was my project doing, instead of asking how
>>> override the connection to a server.
>>>
>>> if this is not a subject of interest of this group, I do apologize for
>>> having misunderstood the aim of it. However I still don't understand why
>>> this should be offtopic.
>>>
>>> Giovanni
>>>
>>> PS: I couldn't figure out a way to search into archives from
>>> http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/. I used
>>>       
>> google
>>     
>>> "site:" option, and found no entry for "pac" or wpad.
>>>
>>>
>>>
>>> On Jan 22, 2008 6:20 PM, Joe Lewis <joe@joe-lewis.com> wrote:
>>>
>>>
>>>       
>>>> First, I want to apologize for keeping this off-topic conversation one
>>>> last time on the mailing list.  I think if we allow this to be
>>>>         
>> archived,
>>     
>>>> any questions should be more easily answered using archives, hopefully
>>>> reducing our work load.
>>>>
>>>>
>>>> Giovanni Donelli wrote:
>>>>
>>>>         
>>>>> Hi
>>>>>    Thanks for your reply. I do apologize for not being clear. I will
>>>>> try to restate what I want to achieve. For the sake of this discussion
>>>>> allow me to simplify the browser/internet interaction as follows:
>>>>>
>>>>> User enters URL in browser ->  **browser resolves domain name** ->
>>>>> connect to server x -> HTTP request....
>>>>>
>>>>> In the way the browser **resolves** the DNS is where the pac file is
>>>>>
>>>>>           
>>>> used.
>>>>
>>>> You may want to read and understand the specification first.  Remember
>>>> that browsers do not reconfigure each time a page is hit - they obtain
>>>> the configuration once (via a direct URL to a .pac, a DHCP response, or
>>>> a DNS lookup for a wpad hostname - it's in the spec).
>>>>
>>>> The only time in those activities that apache could be involved is in
>>>> the direct URL to a .pac file - and it's a static .pac file you drop on
>>>> the web server, or serve the proxy.dat file that the DHCP specified or
>>>> the DNS method is trying to find.  In any way, nothing according to
>>>> apache is occurring that is dynamic - it's just serving a .pac or .dat
>>>> file.
>>>>
>>>> Which means there is no need to set up an apache module that handles
>>>> stuff like this unless you are really crazy and want to construct a
>>>> dynamically generated .pac/.dat file (I would not suggest this).
>>>>
>>>> If that is the direction you want to go, we may be able to assist -
>>>> however, I doubt that is what you want.  Most proxy servers have static
>>>> IP addresses, which means the .pac/.dat file should be static as well.
>>>>
>>>> Once again, may apologies to those who are expecting module development
>>>> assistance in this as we're not sure we even need it yet.
>>>>
>>>> Joe
>>>> --
>>>> Joseph Lewis <http://sharktooth.org/>
>>>> "Divide the fire, and you will sooner put it out." - Publius Syrus
>>>>
>>>>
>>>>         
>>>       
>> Are you trying to make Apache follow the same rules as the browser when
>> it proxies (as in a proxy that uses a proxy), or just trying to set it
>> up?  (as in double proxy)?
>>
>> Joe
>> --
>> Joseph Lewis <http://sharktooth.org/>
>> "Divide the fire, and you will sooner put it out." - Publius Syrus
>>
>>     
>
>   


-- 
Joseph Lewis <http://sharktooth.org/>
"Divide the fire, and you will sooner put it out." - Publius Syrus

Mime
View raw message