You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mike Kennedy <mk...@oucpm.org> on 2011/06/07 17:32:03 UTC

Multiple hosts pointing to different index files for one webapp

I have been asked to launch a new webapp in Tomcat via different URLs, with
each URL pointing to a different launch page for the same app. For example:

portal1.com --> webapps/portalapp/portal1_index.jsp

portal2.com --> webapps/portalapp/portal2_index.jsp

 

I don't know if this should be done by the app itself, or if there is a
simple/complicated way to do it in Tomcat. I have researched through the
O'Reilley Tomcat book, tomcat docs, and various forums, and have not found
any config documentation to do it. A welcome-file specification in the app's
web.xml doesn't seem to cut it, and I have tried to rig an Apache proxy but
still cannot get the right index file to be called first. Likely I just do
not fully understand some settings in Tomcat or Apache to do this right
(perhaps 'appBase' under <Host> or 'path' and 'docBase' under <Context> can
be used), hence I come to you. Any assistance is much appreciated. I hope my
description is clear; if there is more info/config stuff I can post let me
know.

 

I am running Tomcat 5.5.23 and Apache 2.2.3 on Redhat Linux 5, with
jdk-1.6.0_07-fcs. Here are some relevant sections of my configs that get me
as close as I have come. I can launch the app by domain URL, but not without
still specifying the index page in the URL (http://portal1.com/ won't work,
have to use http://portal1.com/portal1_index.jsp).

 

from server.xml:

<Host name="portal1.com" appBase="webapps/portal"

       unpackWARs="true" autoDeploy="true"

       xmlValidation="false" xmlNamespaceAware="false">

       <Context path="" docBase="."

       debug="0" reloadable="false"/>

      </Host>

 

from httpd.conf:

 

<VirtualHost ipaddr:80>

DocumentRoot /var/www/html/portal1

ServerName portal1.com

<Directory "/var/www/html/portal1/">

allow from all

Options -Indexes

</Directory>

DirectoryIndex portal1_index.jsp

# Added to proxy for Tomcat

ProxyRequests Off

<Proxy *>

Order deny,allow

Allow from all

</Proxy>

ProxyPass / http://portal1.oucpm.org:8080/

ProxyPassReverse / http://portal1.oucpm.org:8080/

ProxyVia On

ProxyPreserveHost Off

</VirtualHost>

 

Again, many thanks for your consideration.

-Mike

 


RE: Multiple hosts pointing to different index files for one webapp

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Mike Kennedy [mailto:mkennedy@oucpm.org] 
> Subject: Multiple hosts pointing to different index files for one webapp

> I have been asked to launch a new webapp in Tomcat via different URLs,
> with each URL pointing to a different launch page for the same app.

Probably the easiest way to handle this is with a filter.  Look here:

http://www.tuckey.org/urlrewrite/

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org