I have 1 apache load balancer www.mydomain.com setup for 2 underlying web server www1, www2. However I can't get it rewrite the URL to www. The setup is fine for static html page. Anyone have experience on that. Thank you very much!!
Load balancer setup as below
ProxyRequests Off
ProxyPass / balancer://cluster/ stickysession=BALANCEID nofailover=On
ProxyPassReverse / http://www1.mydomain.com/
ProxyPassReverse / http://www2.mydomain.com/
<Proxy balancer://cluster>
BalancerMember http://www1.mydomain.com/ route=www1
BalancerMember http://www2.mydomain.com/ route=www2
ProxySet lbmethod=byrequests
</Proxy>
web server setup as below
<VirtualHost 192.168.1.1:80>
ServerName www1.mydomain.com
ServerAlias www.mydomain.com
DocumentRoot "/u01/mydomain/wwwroot/www"
CustomLog /u01/mydomain.com/logs/www1.mydomain-access.log combined
ErrorLog /u01/mydomain.com/logs/www1.mydomain-error.log
RewriteEngine On
RewriteRule .* - [CO=BALANCEID:balancer.www1:.www.mydomain.com]
<Directory "/u01/mydomain.com/wwwroot/www/">
AllowOverRide All
</Directory>
</VirtualHost>
<VirtualHost 192.168.1.2:80>
ServerName www2.mydomain.com
ServerAlias www.mydomain.com
DocumentRoot "/u01/mydomain/wwwroot/www"
CustomLog /u01/mydomain.com/logs/www2.mydomain-access.log combined
ErrorLog /u01/mydomain.com/logs/www1.mydomain-error.log
RewriteEngine On
RewriteRule .* - [CO=BALANCEID:balancer.www2:.www.mydomain.com]
<Directory "/u01/mydomain.com/wwwroot/www/">
AllowOverRide All
</Directory>
</VirtualHost>