问题描述
是否可以使用重写为一个不同的Tomcat实例?
我使用 crossContext =true工作
重写到同一个tomcat实例上的不同servlet,但我们的生产服务器有多个运行的tomcat实例,我想要改为改写其中一个?
Is is possible to use Tuckey's URL Rewrite to rewrite to a different 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?
如果使用URL Rewrite过滤器是不可能的,还有另一种方法吗?
If it's not possible using the URL Rewrite filter, is there another way of doing it?
谢谢。
推荐答案
您不能简单地重写到另一个实例。你要么必须从另一个实例中获取内容(例如使用`new URL()。openConnection()....')或使用30x重定向重定向客户端。如果您在Tomcats前面有代理,您可以将其配置为直接解析重定向,而不是将其发送到客户端。
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.
这篇关于我可以对其他Tomcat实例执行URL重写吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!