httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dfw-apa...@white.u-net.com
Subject Re: [users@httpd] mod_proxy_balancer - no way to name pool members by IP.
Date Wed, 20 Apr 2011 18:12:35 GMT
On Fri, Feb 04, 2011 at 11:06:48PM +0000, dfw-apache@white.u-net.com wrote:
> On Fri, Feb 04, 2011 at 05:36:01PM +0000, Igor Gali?? wrote:
> > 
> > > > > But ProxySet only allows you to set the same Variables as
> > > > > ProxyPass does. host is none of them.
> > > > 
> > > > Indeed. This appears to be the problem. Such an option is missing.
> > > 
> > > Right now I'm looking into 2.2's source to see how to add an option
> > > preservehost=(on|off).
> > > 
> > > Can you please test:
> > > http://people.apache.org/~igalic/patches/mod_proxy-preserve_host.diff
> > > 
> > > duh.. nodocumentationpatch!
> > > But I'm pretty sure you can guess how to use it ;)
> > 
> > http://people.apache.org/~igalic/patches/mod_proxy-preserve_host.2.diff
> > Adds: Documentation, CHANGES update, MMN bump
> > Also has a _set variable analogous to the other options.
> > 
> > Bonus: compiles.
> > Untested so far.
> 
> Thanks. I've poked and snuffled, but a co-worker has pointed out that
> there may be problems if this worker is a member of two different balance
> pools. The connection properties would be controlled by the worker, but
> what is sent down that connection should be controlled by the balancer pool.
> 
> I followed your earlier lead when you mentioned ProxyPreserveHost is now
> localisable in trunk. I dug out svn commit r824072 which looks to be exactly
> what I need. It should prevent shared workers getting mixed up by allowing
> me to set the Host at the <Proxy balancer://..> level.
> 
> I have a sneaking suspicion trying to set <Proxy http://10.*> for a worker
> would never work anyway, as the system won't see that as the destination.
> It will see the balancer instead, so only the <Proxy balancer://..> config
> would apply anyway.
> 
> We'll see how far I get.

As it turns out, after a very long journey, I didn't get very far at all.

After backporting the localisable ProxyPreserveHost patch I successfully overwrote the Host
header from inside a Proxy block, allowing me to control which vhost I talked to on the backend
member. Unfortunately this kludged Host header makes its way into your cached object headers
and your access log...

Now, you can fix the log by catching the Host in a Setenvif and logging that, and I don't
*think* anything looks at the Host header in the cached object, but it turns out there is
a more unpleasant problem :

This works as expected :
RewriteRule /foo(.*) balancer://back.foo.com/fooback/$1 [P]

And this also proxypasses, but *none* of the directives in the <Proxy balancer://back.foo.com/>
take effect: 
<Location /foo>
 RewriteRule /foo(.*) balancer://back.foo.com/fooback/$1 [P]
</Location>

No, I don't know why. Without the Proxy block directives to control the Host header sent to
the backend, the backend gives us the finger, as its balancer member IP/hostname is not the
vhost we want.

I also needed to backport a few mod_proxy_http.c thread safety patches from 2.3 to 2.2.17
or else apachebenching was just a massacre.

I think I'm going to have to retreat. It looks like I will need a patch to *specify* a host
header at the balancer config level.

Does anyone have any tips on how this might be done?

DFW

PS: "Ignoring parameter 'lbset=0' for worker 'http://10.1.2.3' because of worker sharing"
(I backported a log verbosity patch too) 

Ignoring the other variables I can understand, but shouldn't lbset be unique to each balancer?
e.g. I share the same backend workers amongst several balancers, but each backend IP may serve
each vhost to a differing degree.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message