We have a working production mod_proxy_balancer configuration for two backend web servers that is working great, except... The backend web servers need the IP address of the clients to identify their location.

Yes, I had suggested just adding a location drop down so that users could select their own location. Too inconvenient for the end user they say.

They want "c_loc=xxx" added to the URL at the load balancer. Okay, this sounds like a job for mod_rewrite. This should be easy enough.

mod_proxy works great, mod_rewrite works great, I put the to together and they seem to not like each other.

Below is one of the many configurations I've tried. The best I can get is the URI components are mixed up incorrectly. Any ideas?

My build of apache:
tar -xvzf httpd-2.2.8.tar.gz
cd httpd-2.2.8
CFLAGS="-O2" ./configure --enable-http --enable-info=shared \
--enable-ssl=shared --enable-rewrite=shared --enable-speling=shared \
--enable-cgi=shared --enable-deflate=shared --enable-disk-cache=shared \
--enable-cache=shared --enable-proxy=shared --enable-proxy-http=shared \
--enable-proxy-balancer=shared --prefix=/vol/devl/loadbalancer
make
make install

<VirtualHost catalog-devl.tld.org:81>
   ServerName catalog-devl.tld.org
   LogLevel debug

   <Proxy *>
       AddDefaultCharset off
       Order Allow,Deny
       Allow from all
   </Proxy>

   <Location /balancer-manager>
       SetHandler balancer-manager
       Order Allow,Deny
Allow from 192.168.200.0/24 192.168.222.0/24 192.168.223.0/24 192.168.220.13
   </Location>

   <Location />
       Order Allow,Deny
       Allow from 192.168.0.0/16 172.16.0.0/12
   </Location>

   # Add the client's location number to the URL
   RewriteEngine On
   # Large list of locations goes here.  List removed to shorten for email
   RewriteCond %{REMOTE_HOST}  ^192\.168\.1\.[5-8]
RewriteRule /.*\.aspx?\? http://catalog-devl.tld.org%{REQUEST_URI}&c_loc=730 [L]
   RewriteCond %{REMOTE_HOST}  ^192\.168\.220\.
   # Here are things I have tried
RewriteRule "^/(.*)$" proxy:balancer://aquabrowser$1&c_loc=220" [QSA,L] # I get 404 Error: "GET //cd/README&c_loc=220%22?test=1 HTTP/1.1" in the logs of the backend server. RewriteRule "^(.*\?.*)$" "http://catalog1.tld.org%{REQUEST_URI}&c_loc=220"; [L,P] # I get 404 Error: "GET /cd/README&c_loc=220?test=1 HTTP/1.1" in the logs of the backed server.
   # This is a long list other things I have tried.  Nothing seems to work.

   ProxyRequests Off
   ProxyVia On
   ProxyPreserveHost On

   ProxyPass /balancer-manager !

   # Catalog Development
   ProxyPass / balancer://aquabrowser/
   <Proxy balancer://aquabrowser>
BalancerMember http://catalogdev.tld.org:80 min=1 smax=20 loadfactor=5 #BalancerMember http://catalog1.tld.org:80 min=1 smax=20 loadfactor=5 route=CAT1 #BalancerMember http://catalog2.tld.org:80 min=1 smax=20 loadfactor=5 route=CAT2
       ProxySet lbmethod=byrequests
       ProxySet stickysession=ABbalancer
       ProxySet nofailover=Off
       ProxySet maxattempts=3
       ProxySet timeout=5
       Order Allow,Deny
       Allow from 192.168.0.0/16 172.16.0.0/12

   </Proxy>
   ProxyPassReverse / http://catalogdev.tld.org
   #ProxyPassReverse / http://catalog1.tld.org
   #ProxyPassReverse / http://catalog2.tld.org
</VirtualHost>


Travis Sidelinger


---------------------------------------------------------------------
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: [EMAIL PROTECTED]
  "   from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to