At work we have many Spring apps running on one tomcat server. Some of the apps have their own domains with a virtualhost in apache that rewrites requests from /url to /context_root/url.
This is all fine and good except for when I use some of springs tag libs that handle urls. An example is the <form:form>
tag which creates an action of /context_root/form and takes the user away from /. Now, the app still works when that happens but management doesn't want to see the context root.
What is the best way to tackle this?
In case anyone stumbles into this, I did end up finding the answer.
With Tomcat you can have multiple hosts. So I setup a host with my app as the default webapp. Here's an example:
Add another Host to server.xml
<Host name="lilhug.mydomain.com" appBase="lilhug"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false"/>
Create some files and directories
mkdir $CATALINA_HOME/lilhug
mkdir $CATALINA_HOME/conf/Catalina/lilhug.mydomain.com
If you want the Tomcat manager for this host
cd $CATALINA_HOME/conf/Catalina
cp localhost/manager.xml lilhug.mydomain.com
Then restart tomcat and you're good. Deploy the lilhug app to /
using the /manager
running at your new host or copy the war to $CATALINA_HOME/lilhug/ROOT.war