<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
I'm not really the best with how the Context attribute works outside of having it placed in the server.xml. I've tried reading the documentation on Contexts at:
http://tomcat.apache.org/tomcat-5.5-doc/deployer-howto.html But, I find what is explained a tad bit confusing.
Here is one
thread from the archives that explained our problem pretty well, but there never really was an answer on how to accomplish the task except "you're getting the right behavior with a 400 response":
http://marc.info/?l=tomcat-user&m=115602705505727&w=2 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.