<note> This question was also posted on the Tomcat Mailing List. Sorry if you're reading this twice... </note>
We've been given a difficult problem to solve and I'm hoping that some help/insight is available on this mailing list.
We are an Application Service Provider (ASP) that has numerous clients with the number of clients increasing rapidly. All our clients use the same application but each client needs/wants a distinguishing element in the url to identify them to their users.
Here is our current setup:
Apache 2.2 with mod_jk sending requests to Tomcat 5.5. Struts 1.3.8 is our current web framework.
In our httpd.conf we have a different domain name for each client:
<VirtualHost *:80> ServerName <client name 1>.<server name>.com DocumentRoot <some directory>/<client name 1>.<server name>.com </VirtualHost>
<VirtualHost *:80> ServerName <client name 2>.<server name>.com DocumentRoot <some directory>/<client name 2>.<server name>.com </VirtualHost>
Then in our server.xml config file for Tomcat we only declare one Host element with a Context that has many Alias':
<Host name="<client name 1>.<server name>.com" appBase="webapps"> <Context path="/app" > </Context> <Alias><client name 2>.<server name>.com</Alias> <Alias><client name 3>.<server name>.com</Alias> ...etc for each of our clients... </Host>
So, what is the problem? Well, when we add a new customer we have to edit the httpd.conf, the server.xml, restart both applications, and add the new <customer>.<server name>.com to DNS (Usually, we have to wait until late into the evening to do these tasks). Our Client Services team want the ability to add customers without having to wait until we can restart our servers.
Is it possible to do the following with an Apache 2.2 and Tomcat 5.5 combination while having only ONE instance of the application only once loaded in Tomcat? (Meaning we do NOT want the application loaded by Tomcat x times, with x being the number of clients we have.)
<base name>.<server name>.com/<client name 1>/app <base name>.<server name>.com/<client name 2>/app <base name>.<server name>.com/<client name 3>/app
Finally, through some other research, it seems as though someone was trying to use mod_vhost_alias to accomplish the same thing.
Any thoughts or suggestions are welcome.
Thank you for your time.
Joined: Mar 22, 2005
<base name>.<server name>.com/<client name 1>/app <base name>.<server name>.com/<client name 2>/app
I would do
<base name>.<server name>.com/app/<client name 1> <base name>.<server name>.com/app/<client name 2>
That way nothing needs to be configured in httpd, nothing needs to be configured in Tomcat, and you have just a single web app. Everything related to keeping customer apart can be done inside of the web app. Case closed
You'd only need to do this for the start/login page, because after that you can remember the clientID in the server session (and you really need logins/passwords, or clients WILL hack their way into other clients app). Then all the *.do URLs that come after that don't need the client parameter - they look the same for all clients.