如何将Tomcat 5.5接收的请求redirect到另一个主机上的另一个Tomcat实例,就像我可以在具有重写规则的Apache主机上一样?
例如:我想将http://example.com:8080/xmpl上的所有请求redirect到http://example.org:8080/xmpl (具有完整path和GET参数),但是保留http://example.com:8080/regular在端口8080的example.com上的http://example.com:8080/regular for Tomcat。这里example.com和example.org是完全不同的主机。
最后,我们使用了带URL重写filter的占位符webapp, http://tuckey.org/urlrewrite/以及Erik Isaksson的filterconfiguration。 这使我们无需重新启动服务器,这对于具体情况非常重要。
把Apache放在你的Tomcat前面,使用mod_jk和你的tomcat交谈。 然后你可以使用Apache的所有function和特性,因为Tomcat确实没有任何你自己编程的东西。