how to do auto redirection of a tomcat application

Paul Graydon paul at
Wed Feb 23 22:23:16 UTC 2011

On 02/23/2011 11:30 AM, Tapas Mishra wrote:
> I have a site
> 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
>          ServerAdmin webmaster at localhost
>          ProxyRequests off
>          <Proxy *>
>          Order deny,allow
>          Allow from all
>          </Proxy>
>          ProxyPreserveHost On
>          ProxyPass / ajp://
>          ProxyPassReverse / ajp://
> </VirtualHost>
> How ever I have an application running on it
> what I want to do is when some one opens
> 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://
ProxyPassReverse / ajp://

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://
ProxyPassReverse /olat ajp://

That means when someone browses to they will 
automatically be redirected to


More information about the ubuntu-server mailing list