开发者

Can I do a URL Rewrite to a different Tomcat instance?

开发者 https://www.devze.com 2022-12-24 03:00 出处:网络
Is is possible to use Tuckey\'s URL Rewrite to rewrite to a di开发者_C百科fferent Tomcat instance?

Is is possible to use Tuckey's URL Rewrite to rewrite to a di开发者_C百科fferent Tomcat instance? I have it working using crossContext="true" rewriting to a different servlet on the same tomcat instance, but our production server has multiple tomcat instances running and I want to rewrite to one of them instead?

If it's not possible using the URL Rewrite filter, is there another way of doing it?

Thanks.


You can't simply rewrite to another instance. You'd either have to fetch the content from another instance (e.g. using `new URL("http://localhost:8081/foo").openConnection()....´) or redirect the client using a 30x redirect. If you have a proxy in front of your Tomcats, you might be able to configure it to resolve the redirect directly instead of sending it to the client.


If you want to proxy the request then you need to use mod_jk or mod_proxy in Apache to proxy the request to a different machine. If you are OK with issuing a redirect then it should work fine with just URL Rewrite.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号