sandeepkunkunuru sandeepkunkunuru - 18 days ago 5x
Apache Configuration Question

Can we point multiple urls to the same webapp in tomcat

I am using an apache web server and a tomcat server for hosting few webapplications.

These webapplications not very different from one another and I want to consolidate all these webapplications into one webapp to minimize the process overheads.

The webapplications are currently being accessed with separate urls ex: localhost:8080/webapp1, localhost:8080/webapp2.

Without changing the urls is there a way that I can host a webapplication on tomcat say "singlewebapp" such that it will respond to both localhost:8080/webapp1 as well as localhost:8080/webapp2?


One of my team members suggested an idea on symlinks and junctions which triggered a discussion on apache tomcat's docbase feature and we found a very elegant answer to this question in it.

Let's say the webapplication is abc.war. We deploy abc.war in tomcat webapps as abc folder then we need to configure the server.xml of tomcat as follows and restart tomcat:

<Host ...>
  <Context path="/webapp1" docBase="/abc" /> 
  <Context path="/webapp2" docBase="/abc" /> 

Believe this is very useful usage for supporting white-labelling and multi-tenancy.