tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: tomcat - How to forward request to some webapp while using port 80 without virtual host, without apache
Date Sat, 28 Dec 2013 16:49:01 GMT
Peter wrote:
> Hi all, I have many entries in /etc/hosts file, like this
> 
> cat /etc/hosts
> 127.0.0.1 main.host.com localhost
> ::1        localhost6.localdomain6 localhost6
> a.b.c.d client1.host.com hostname
> a.b.c.d client1.host.com hostname
> 
> in webapp directory, webapp folders
> 
> client1
> client2
> 
> my tomcat uses port 80, so by default when I enter any of above hostname on
> browser I could see default index page, but my interest is like below
> 
> if I enter *http://client1.host.com <http://client1.host.com>* on browser,
> then tomcat should forward it to webapp client1
> 
> *http://client1.host.com/client1 <http://client1.host.com/client1>*
> same way if I enter *http://client2.host.com <http://client2.host.com> *it
> should forward to to
> 
> 
> *http://client2.host.com/client2 <http://client2.host.com/client2>*
> How this can be achieved
> 
> 
> 
> *I am not interested to use virtual host in tomcat,

The question here would be : why not ?
Because that is the usual (and most "natural") way of doing the kind of thing that you want.

Other than virtual hosts, you can do as Chuck suggests, and use a servlet filter in the 
ROOT webapp to re-direct, but it is almost guaranteed to give you headaches later on, when

your pages will contain self-referencing URLs and the like.
Or else, it will be very inefficient, because you will have 2 round-trips to the browser 
for each access.


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


Mime
View raw message