On 04/08/2006 09:40 AM, Bjørn Stabell wrote:

> 
> In Apache 2.2.1 (the release candidate) mod_proxy_balancer and 
> mod_deflate seems ok, but either mod_proxy or mod_rewrite is breaking 
> badly.  Here's what the trimmed down config file looks like (it still 
> exhibits the same problem):
> 
>     Listen 192.168.100.22:80
>     <VirtualHost 192.168.100.22:80>
>             ServerName www.domain.com
> 
>             RewriteEngine On
>             RewriteRule ^/external/(.*)       
> http://192.168.100.66:8099/$1 [P]
>             RewriteRule  ^/(.*)            http://127.0.0.1:8080/$1 [P]
>     </VirtualHost>
> 
> What happens is:
> 
> SCENARIO 1:
> 
> 1. Restart Apache
> 
> 2. Access http://www.domain.com/
> -> is proxied to 127.0.0.1:8080 as expected
> 
> 3. Access http://www.domain.com/external/ (and all subsequent requests)
> -> is still proxied to 127.0.0.1:8080, although rewrite_log shows it 
> matches the /external rule

As I investigated this one thing came up to my mind:

If you use the proxy in the way described above the '*' worker will be used 
which
will be created automatically. Having the generic '*' available is a good 
thing, BUT
this is not optimal from the performance point of view in these situations as 
the '*'
worker has changing remote addresses and thus does not benefit from keepalives 
to the
backend as much as it could. OTOH ProxyPass which creates explicit workers does 
not
know regular expressions and is not well suited for more complex situations. 
The only
other way to create a worker for a defined target is to add a BalancerMember to 
a
balanced backend.
So what about adding a directive called ProxyAddWorker that just defines a 
worker?
This would enable the following configuration:

     Listen 192.168.100.22:80

     ProxyAddWorker http://192.168.100.66:8099/ max=10
     ProxyAddWorker http://127.0.0.1:8080/ max=20

     <VirtualHost 192.168.100.22:80>
             ServerName www.domain.com

             RewriteEngine On
            RewriteRule ^/external/(.*)       http://192.168.100.66:8099/$1 [P]
             RewriteRule  ^/(.*)            http://127.0.0.1:8080/$1 [P]
     </VirtualHost>

Of course ProxyAddWorker should not be mandatory. If the worker is not defined
the '*' worker should still be used.

Regards

Rüdiger

Reply via email to