You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Joe Lewis <jo...@joe-lewis.com> on 2008/01/22 19:20:03 UTC
Re: mod_proxy chaining with a .pac file - OFF-TOPIC?
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
Re: mod_proxy chaining with a .pac file
Posted by Giovanni Donelli <gi...@gmail.com>.
On Jan 23, 2008 6:27 PM, Ralf Mattes <rm...@seid-online.de> 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.
>
>
> Cheers, RalfD
>
Thanks RalfD. You got exactly the point.
Re: mod_proxy chaining with a .pac file
Posted by Giovanni Donelli <gi...@gmail.com>.
Great. Thanks! This solve 50% of the problem.
The other problem is to actually plug this into mod_proxy. Is there a hook a
can use to override the connection to the remote server?
What do you guys suggest?
thanks!
On Jan 24, 2008 12:50 PM, Ralf Mattes <rm...@seid-online.de> wrote:
> On Wed, 2008-01-23 at 22:19 +0000, Giovanni Donelli wrote:
> > Are you talking about a JS lib or a code that does what I need, support
> for
> > .pac proxy chaning?
>
> The later.
> Sorry, that library wasn't linked to from your original post, but it can
> be found on the wikipedia page. Here's a direct link:
>
> http://code.google.com/p/pacparser/
>
> >From browsing the documentation it looks like it does all you need.
>
> HTH RalfD
>
>
> > As with regards with JS I was going to use the WebKit's JavaScriptCore.
> >
> >
> > > 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
> > >
> > >
>
>
Re: mod_proxy chaining with a .pac file
Posted by Ralf Mattes <rm...@seid-online.de>.
On Wed, 2008-01-23 at 22:19 +0000, Giovanni Donelli wrote:
> Are you talking about a JS lib or a code that does what I need, support for
> .pac proxy chaning?
The later.
Sorry, that library wasn't linked to from your original post, but it can
be found on the wikipedia page. Here's a direct link:
http://code.google.com/p/pacparser/
>>From browsing the documentation it looks like it does all you need.
HTH RalfD
> As with regards with JS I was going to use the WebKit's JavaScriptCore.
>
>
> > 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
> >
> >
Re: mod_proxy chaining with a .pac file
Posted by Giovanni Donelli <gi...@gmail.com>.
Are you talking about a JS lib or a code that does what I need, support for
.pac proxy chaning?
As with regards with JS I was going to use the WebKit's JavaScriptCore.
> 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
>
>
Re: mod_proxy chaining with a .pac file
Posted by Ralf Mattes <rm...@seid-online.de>.
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
Re: mod_proxy chaining with a .pac file
Posted by Joe Lewis <jo...@joe-lewis.com>.
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.
Joe
--
Joseph Lewis <http://sharktooth.org/>
"Divide the fire, and you will sooner put it out." - Publius Syrus
Re: mod_proxy chaining with a .pac file
Posted by Ralf Mattes <rm...@seid-online.de>.
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.
Cheers, RalfD
> Joe
>
>
> > On Jan 23, 2008 2:34 PM, Joe Lewis <jo...@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 <jo...@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
> >>
> >>
> >
> >
>
>
Re: mod_proxy chaining with a .pac file
Posted by Joe Lewis <jo...@joe-lewis.com>.
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 <jo...@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 <jo...@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
Re: mod_proxy chaining with a .pac file - OFF-TOPIC?
Posted by Giovanni Donelli <gi...@gmail.com>.
I am trying to make Apache follow the same rules as the browser
On Jan 23, 2008 2:34 PM, Joe Lewis <jo...@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 <jo...@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
>
Re: mod_proxy chaining with a .pac file - OFF-TOPIC?
Posted by Joe Lewis <jo...@joe-lewis.com>.
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 <jo...@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
Re: mod_proxy chaining with a .pac file - OFF-TOPIC?
Posted by Giovanni Donelli <gi...@gmail.com>.
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 <jo...@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
>