I now have one Apache server and two Tomcat servers. They are connected using mod_jk module. And the load balancing is configured. All request will be redirected to the loadbalancer, in httpd.conf:
JKMount /* controller
The controller is the loadbalancer, and the working tomcat servers are worker1, worker2.
The problem is that, in addition to the automatic load dispatch, I also need a url matching redirection. Speicifically, the request for http://www.example.com/test1/index.html should go to worker1 (Tomcat), and http://www.example.com/test2/index.html go to worker2. However, in both worker1 and worker2, the application structure is webapps/test/ structure.
I can use the mod_jk url mapping to dispatch /test1/ to worker1 and /test2/ to worker2, but the PATH will be /test1/ and /test2/ not /test/. Meanwhile, if I use the apache redirectMatch or url rewrite to change the /test1/(/test2/) to /test/, the mod_jk will not dispatch the url to the different worker now, since they have the same PATH.
How can I deal with this situation?