简体   繁体   English

Tomcat:两个不同的战争在不同的端口上运行

[英]Tomcat: Two different wars operate on different ports

I have two different APIs.我有两个不同的 API。 They each have their own .war file and are both running on the same tomcat instance.它们每个都有自己的 .war 文件,并且都在同一个 tomcat 实例上运行。

Strangely, I am able to reach one API with requests like this: https://(ip-address):443/(path1)奇怪的是,我可以通过如下请求访问一个 API:https://(ip-address):443/(path1)

but the other responds only to this: http://(ip-address):8090/(path2)但另一个只对此作出回应:http://(ip-address):8090/(path2)

Also complicating things is that, when I deploy the second war to a certain other tomcat instance on another server, it will respond to https 443 requests.同样复杂的是,当我将第二次战争部署到另一台服务器上的某个其他 tomcat 实例时,它将响应 https 443 请求。

Any idea how this is possible?知道这怎么可能吗?

This is strange, because at different times either the war or tomcat works as intended (by using https), so it is unclear whether to blame the war or tomcat.这很奇怪,因为在不同的时间,无论是战争还是 tomcat 都按预期工作(通过使用 https),所以不清楚是责怪战争还是 tomcat。

Applications can declare they need confidential connections (HTTPS).应用程序可以声明它们需要机密连接 (HTTPS)。 Look at the WEB-INF/web.xml inside.查看里面的WEB-INF/web.xml。

So one of the applications might use both because there is no constraint defined, the other may just respond to https as the container is responsible to ensure secured communication.因此,其中一个应用程序可能会同时使用两者,因为没有定义约束,另一个可能只是响应 https,因为容器负责确保安全通信。 I'd be more surprised to hear that one of the applications responds to http only.听到其中一个应用程序仅响应 http,我会更加惊讶。

From https://tomcat.apache.org/tomcat-9.0-doc/config/http.html#Introduction : One or more such Connectors can be configured as part of a single Service, each forwarding to the associated Engine to perform request processing and create the response.来自https://tomcat.apache.org/tomcat-9.0-doc/config/http.html#Introduction一个或多个这样的连接器可以配置为单个服务的一部分,每个转发到关联的引擎以执行请求处理并创建响应。

Check in your server.xml whether you have several services with http and https connectors that are mapping to different engines, and whether the applications are deployed distributed on these different engines.检查您的 server.xml 是否有多个带有 http 和 https 连接器的服务映射到不同的引擎,以及应用程序是否分布在这些不同的引擎上。 That could explain one application responding to http only, while the other is responding to https only.这可以解释一个应用程序仅响应 http,而另一个应用程序仅响应 https。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM