Hey everyone.
I've been looking for a solution to my problem for two days now, scanning
through the archives without any luck. So, I'm hoping someone here can help
me.
 
Following are the specs of my system:
 
Tomcat 4.01
Apache 1.3
JDK 1.2
Solaris 7
 
I built Apache and mod_webapp, and Tomcat now successfully serves up dynamic
content through Apache.
 
Before I can describe the problem, I'll have to give you some background
information. 
 
The first thing you need to know, is that I have a number of domain names
all pointing to the same IP address (server1.mydomain.com,
server2.mydomain.com, etc.). Apache listens on that IP address, and the same
web application serves all those domain names. The thing is that my web
application responds differently to the different domain names. For example
if the user goes to server1.mydomain.com in his browser, he gets a different
looking page than if he would go to server2.mydomain.com. The web
application selects the right content by reading the hostname.
 
The second thing you need to know, is that the webapp runs in the root
context.
 
Now, I've put the following lines into my httpd.conf:
 
WebAppConnection conn warp localhost:8044
WebAppDeploy mywebapp conn /

(and yes, I deliberately changed the warp port to 8044 for reasons that are
not the subject of this discussion). Also the ServerName in httpd.conf is
set to the IP address of the server.
 
Let's say that my IP address is 123.45.67.89. Now, if I point my browser to
http://123.45.67.89 <http://123.45.67.89> , the webapplication serves up
dynamic content. But if I point it to http://server1.mydomain.com
<http://server1.mydomain.com>  (which is pointing to 123.45.67.89), it
redirects me to http://123.45.67.89 <http://123.45.67.89> . The same goes
for server2.mydomain.com, etc. 
 
And things get even stranger. If I include the index.jsp in the path, then
the server does not redirect!!! That is, if I point the browser to
http://server1.mydomain.com/index.jsp
<http://server1.mydomain.com/index.jsp>  (appending the "/index.jsp"), then
Apache does not redirect and the webapp can serve the correct content.
 
This just started to happen after I upgraded Tomcat from 3.2 using mod_jserv
to Tomcat 4.01 using mod_webapp.
 
I know that you can add virtual hosts in httpd.conf, but that is an
unacceptable solution for me, because the httpd.conf should not be edited if
a new domain name is added.
 
I need some workaround for this, so that the hostname that the user inputs
stays the same.
 
If you can think of a solution, please bear in mind that it must fulfill the
following requirements:
 
1. The webapp MUST run in the root context.
2. The Apache httpd.conf SHOULD NOT HAVE TO BE EDITED if a new domain name
pointing to the IP address of the server is added.
 
Any help is greatly appreciated.
 
Gauti.

Reply via email to