I've been trying for the last couple of days to get this small (i though) scenario working.
Small drawing of my architecture.
request
|
ApacheLB
|
|---------|
Apache1 Apache2
Tomcat1 Tomcat2
So far i can get the following to work, either serving my cluster of Apache servers or serving my cluster of Tomcat servers.
The Apache cluster handles PHP sites and uses sticky sessions (works like a charm) and the Tomcat cluster handles JPS sites and this works as well.
What i need is when an request hits my load balancer (ApacheLB) and the host requested begins with say "admin" then the Tomcat cluster takes over other request handles by the Apache cluster.
Both clusters uses handles multiple sites. Some examples.
http://www.company1.com
http://admin.company1.com
http://www.company2.com
http://admin.company2.com
I´m using Apache 2.4, Tomcat 7, mod_proxy_balancer, all under Windows.
My config.
Apache LB
<VirtualHost *:80>
Header add Set-Cookie "BALANCEID=lb.%{BALANCER_WORKER_ROUTE}e; path=/;" env=BALANCER_ROUTE_CHANGED
ProxyRequests Off
ProxyPreserveHost On
ProxyPass /balancer-manager !
ProxyPass / balancer://lb/ stickysession=BALANCEID nofailover=Off
ProxyPassReverse / http://windows-server1:8009/
ProxyPassReverse / http://windows-server2:8009/
<Proxy balancer://lb>
BalancerMember http://windows-server1:8009/ route=node1 min=3 max=5
BalancerMember http://windows-server2:8009/ route=node2
ProxySet lbmethod=byrequests
</Proxy>
<Location /balancer-manager>
SetHandler balancer-manager
AuthType Basic
AuthName "Balancer Manager"
AuthUserFile "C:/etc/lb/conf/.htpasswd"
Require valid-user
</Location>
</VirtualHost>
Host
<VirtualHost *:8009>
DocumentRoot "c:/etc/www/test"
ServerName www.company1.com
ServerAlias company1.com
<Directory "c:/etc/www/www.company1.com">
AllowOverride All
Order Allow,Deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
Any help would be great! Thanks!
Best regards Robert