how to do auto redirection of a tomcat application
Paul Graydon
paul at paulgraydon.co.uk
Wed Feb 23 22:23:16 UTC 2011
On 02/23/2011 11:30 AM, Tapas Mishra wrote:
> I have a site http://social.openitup.in
> right now what you are seeing is a default Tomcat6 page.
> I am using mod_ajp as a front end and Apache vhost configuration for same is
>
> <VirtualHost *:80>
>
> ServerName social.openitup.in
> ServerAdmin webmaster at localhost
>
> ProxyRequests off
> <Proxy *>
> Order deny,allow
> Allow from all
> </Proxy>
> ProxyPreserveHost On
>
> ProxyPass / ajp://192.168.1.19:8009/
> ProxyPassReverse / ajp://192.168.1.19:8009/
>
>
> </VirtualHost>
>
>
>
>
> How ever I have an application running on it
> http://social.openitup.in/olat
> what I want to do is when some one opens
> http://social.openitup.in
> then rather than seeing Tomcat6 home page from
> /var/lib/tomcat6/webapps/ROOT/index.html
> the person is redirected to olat application which is in
> /var/lib/tomcat6/webapps/olat
> how can this be achived?
>
> The machine where OLAT is and where the above Reverse Proxy
> configuration is are physically different machines.
>
Hi Tapas,
We're using straight http, rather than ajp for proxying to our tomcat
servers (though I'm hoping to transition at some stage), so your mileage
may vary depending on if ajp does anything unusual in relation to
ProxyPass. You may find its as simple as doing this:
ProxyPass / ajp://192.168.1.19:8009/olat
ProxyPassReverse / ajp://192.168.1.19:8009/olat
However, it depends on the java app underneath it. Some of the apps we
run in our tomcat hosting environment can be picky if the URI (bit after
the first / after the domain in the URL) is different from what the
application expects. What we tend to do is use a rewrite:
RewriteEngine On
RewriteRule ^/$ /olat/ [redirect,last]
The have our proxypass lines:
ProxyPass /olat ajp://192.168.1.19:8009/olat
ProxyPassReverse /olat ajp://192.168.1.19:8009/olat
That means when someone browses to http://social.openitup.in/ they will
automatically be redirected to http://social.openitup.in/olat
Paul
More information about the ubuntu-server
mailing list