简体   繁体   中英

Tomcat: Two different wars operate on different ports

I have two different APIs. They each have their own .war file and are both running on the same tomcat instance.

Strangely, I am able to reach one API with requests like this: https://(ip-address):443/(path1)

but the other responds only to this: 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.

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.

Applications can declare they need confidential connections (HTTPS). Look at the WEB-INF/web.xml inside.

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. I'd be more surprised to hear that one of the applications responds to http only.

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.

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. That could explain one application responding to http only, while the other is responding to https only.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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