Cratylus
Cratylus

Reputation: 54074

Map different url to same web application in Tomcat

I am not clear on the following:
If we have a web application named: SomeWebApp under Tomcat's webapp directory, the url to access it is:
http://localhost:8080/SomeWebApp
My question is, is it possible to configure Tomcat so that other URLs would point to that web application?
E.g.
http://localhost:8080/ADifferentApp will also point to the SomeWebApp?

From the web.xml I think is not possible since it is about the url patterns when you are inside the SomeWebApp scope.

So what is the proper way to do it? If it is possible that is.

Upvotes: 4

Views: 3739

Answers (3)

user3337349
user3337349

Reputation: 1

Yes,its possible to map different context path to single application edit conf/server.xml file

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

Access application with 2 URL's

Upvotes: 0

Stugal
Stugal

Reputation: 880

I'd rather recommend Nginx than Apache as proxy. I'm recently working on a project that incorporates tomcat and nginx works as proxy. Once you've got nginx you can acctualy map as many url's to access the same web application as you want.

Upvotes: 0

Johan Sj&#246;berg
Johan Sj&#246;berg

Reputation: 49177

The approach I found to work best is to install Apache2 on the server and proxy all requests. Tomcat is surprisingly difficult to configure in other ways than intended. In my experience, Tomcat doesn't provide this functionality declaratively.

Upvotes: 2

Related Questions