1

I have a Tomcat server with two webapps, app1 and app2 (the app part is really the same). Each app has an independent group of users.

I would like the groups to be able to access their respective app using group1.domain.com/app and group2.domain.com/app URLs, meaning that the numbers should be hidden from the URL displayed in browser. I suppose there needs to be a mechanism that would return the correct app based on the group# part of the URL.

I have a vague understanding of URL rewrites. Is there a way to do this with only Tomcat? Or do I need Apache HTTP server? I would rather not use Apache if possible, but have no problem going that way if necessary.

2

It is not really about rewriting url but more about virtual hosting.

You can do it in tomcat with the Host element in server.xml. For your case, you will want an Host group1.domain.com where the appbase (read folder where tomcat look for war) will contain app1 and an Host group2.domain.com where the appbase will point to the folder containing app2.

You will maybe need a default Host for those user agent who use the Ip adress.

Thus something like this in server.xml :

 <Host name="group1.domain.com" appBase="/war/group1"/>
 <Host name="group2.domain.com" appBase="/war/group2"/>

And then app.war in /war/group1 (for the first app) and app.war in /war/group2 (for the second)

see Tomcat documentation for details

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.