Reputation: 41909
Tomcat is currently hosting my in-production ROOT.war
app.
I need to test out a new ROOT.war,
but I don't want to stop my in-production app from running. Note that the app needs to be deployed in the ROOT
folder.
What's the easiest way to do this?
Upvotes: 0
Views: 180
Reputation: 122364
Tomcat can do name-based virtual hosting the same as Apache HTTPD. You need to
<Host>
element to your server.xml
, inside the same Engine
but with a different value for the name
and the appBase
<Host name="app2.example.com" appBase="app2-webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false"/>
app2-webapps
Host
header is passed through untouched (for Apache HTTPD with mod_proxy this means setting ProxyPreserveHost On
Now requests for http://app2.example.com/*
will be handled by your new app, and requests for any other hostname will go to the old one.
I use this technique for hosting several different production applications in one Tomcat, but I wouldn't recommend using the same Tomcat for a mixture of production and development/test applications. Instead it's safer to use a different server, or a second Tomcat instance running on a different port.
Upvotes: 2