Background:
I have a host configured in my Tomcat's server.xml as:
<Host name="mydomain.com"
appBase="webapps/myapp"
unpackWARs="true"
autoDeploy="true"
xmlValidation="false"
xmlNamespaceAware="false">
<Context path="" docBase="."/>
</Host>
Problem:
When I type http://mydomain.com
into my browser, it works well. But when I type http://www.mydomain.com
it shows a blank page.
Workaround I tried:
I tried to create another host as:
<Host name="www.mydomain.com"
appBase="webapps/myapp"
unpackWARs="true"
autoDeploy="true"
xmlValidation="false"
xmlNamespaceAware="false">
<Context path="" docBase="."/>
</Host>
Result:
It seemed to work okay ( when I typed http://www.mydomain.com
, it would show me regular site ). But later I discovered this way Tomcat creates two instances of the same application; that invalidates this approach.
Please let me know if in your opinion there is a better workaround.
Many Thanks!
P.S.
This is my first question at serverfault.com, I am not sure if this question has been asked before ( at least I couldn't find any ). Link to any such related question would also be appreciated.