Apache not routing to tomcat on correct Virtual host
- by ttheobald
We are looking at moving from Websphere to Tomcat. I'm trying to send traffic to tomcat from apache web server based on the virtual host directives in apache web server.
After some playing around I have it sort of working, but I'm noticing that if I have a JKMount directive in the first VirtualHost in apache, all virtualHosts will send to the application server. If I have the JKMount in Virtual hosts further down in the configs, then only that VirtualHost works with the request.
For Example, with the configs below here are my symptoms
mysite.com/Webapp1/ -- I resolve to the proper application
mysite2.com/Webapp1/ -- I resolve to the proper application (bad!)
mysite.com/MonitorApp/ -- I resolve to the proper application
mysite2.com/MonitorApp/ -- I resolve to the proper application (bad!)
mysite.com/Webapp2/ -- I DO NOT get to the app (good)
mysite2.com/Webapp2/ -- I resolve to the proper application
Here's what my web server virtualhosts look like.
<VirtualHost 255.255.255.1:80>
ServerName mysite.com
ServerAlias aliasmysite.ca
##all our rewrite rules
JkMount /Webapp1/* LoadBalanceWorker
JKmount /MonitorApp/* LoadBalanceWorker
</VirtualHost>
<VirtualHost 255.255.255.2:80>
ServerName mysite2.com
ServerAlias aliasmysite2.ca
##all our rewrite rules
JkMount /Webapp2/* LoadBalanceWorker
</VirtualHost>
we are running apache webserver 2.2.10 and tomcat 7.0.29 on Solaris10
I've posted an image of our architecture here. http://imgur.com/IFaA6Rh
I HAVE not defined VirtualHosts on Tomcat. Based on what I've read, my understanding is that it's only needed if I'm accessing Tomcat directly.
Any assistance is appreciated.
Edit
Here's my worker.properties.
worker.list= LoadBalanceWorker,App1,App2
worker.intApp1.port=8009
worker.intApp1.host=10.15.8.8
worker.intApp1.type=ajp13
worker.intApp1.lbfactor=1
worker.intApp1.socket_timeout=30
worker.intApp1.socket_connect_timeout=5000
worker.intApp1.fail_on_status=302,500,503
worker.intApp1.recover_time=30
worker.intApp2.port=8009
worker.intApp2.host=10.15.8.9
worker.intApp2.type=ajp13
worker.intApp2.lbfactor=1
worker.intApp2.socket_timeout=30
worker.intApp2.socket_connect_timeout=5000
worker.intApp2.fail_on_status=302,500,503
worker.intApp2.recover_time=30
worker.LoadBalanceWorker.type=lb
worker.LoadBalanceWorker.balanced_workers=intApp1,intApp2
worker.LoadBalanceWorker.sticky_session=1