Map different URLs for the same web application in Tomcat

I do not understand the following:
If we have a web application named: SomeWebApp in the Tomcat webapp directory, the URL to access it:
http://localhost:8080/SomeWebApp
My question is, is it possible to configure Tomcat so that other URLs point to this web application?
E.G.
http://localhost:8080/ADifferentApp will also point to SomeWebApp ?

From web.xml I think this is not possible, as far as url patterns are concerned when you are inside the SomeWebApp .

So what is the right way to do this? If possible, that is.

+4
source share
3 answers

The approach that seemed to work best for me is to install Apache2 on the server and proxy server for all requests. Tomcat is surprisingly hard to configure in other ways than intended. In my experience, Tomcat does not provide this function declaratively.

+2
source

I would rather recommend Nginx than Apache as a proxy. I recently worked on a project that includes tomcat, and nginx works as a proxy. After you have nginx, you can bind as many URLs to the same web application that you need.

0
source

Yes, it is possible to map a different context path for a separate conf / server.xml application editing file

 > **> <Context docBase="D:\Servers\apache-tomcat-7\webapps\SomeWebApp" > > path="/SomeWebApp" /> > > <Context docBase="D:\Servers\apache-tomcat-7\webapps\SomeWebApp" path="/ADifferentApp "/>** 

Access to the application with two URLs

0
source

Source: https://habr.com/ru/post/1391236/


All Articles