问题
I want to deploy multiple web applications in my tomcat 8.5 server with the same port and different application context. So far by putting all the war in the Webapps directory, I am able to achieve that. Now the use case is one of those application needs to be deployed on 80 port while others will be on 8080 port.
So the set looks like:
http://x.x.x.x:8080/xyz
http://x.x.x.x:8080/abc
http://x.x.x.x:8080/foo
http://x.x.x.x/bar
Now there is a link in /xyz application which redirects to /bar application and these two should share the session between them, otherwise, the link in /xyz application is redirecting to login page.
My query is whether I need to configure anything at tomcat level in order to achieve that. Note that my applications are built on top of Spring MVC
回答1:
Use context docbase as mentioned below
<Context docBase="/your/path/app1"
path="/app1" reloadable="true" />
<Context docBase="/your/path/app2"
path="/app2" reloadable="true" />
来源:https://stackoverflow.com/questions/47089198/how-to-deploy-multiple-applications-in-tomcat-with-the-same-port-and-change-in-c