tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Bruno <>
Subject Re: redirect some requests to another tomcat.
Date Tue, 15 Jun 2010 08:14:26 GMT
This is pretty much what I have been working on.

As a few hints, you'll need Apache in front, and setup AJP on tomcat.

I have set up loadbalancing, and have the two tomcats doing session
sharing, and use the jvmroute to route to respected tomcat.

You might need to change your server webapp "java" code so that you
know which tomcat to jvmroute to.

Basically, with the loadbalancer,it can randomly pick any tomcat.
When the user logs in, I have some business logic to detect whether
they should be on current web app.  if they are not, I save session
details, and then I redirect to url again, but append the
jsessionid=SESSIONID.worker2 to url, and Apache knows from that to
automatically use worker2.  (assuming worker2 is the tomcat web app
user is supposed to be on).

The only thing I am worried about is race conditions with session
replication.  The worst that can happen is that the user will need to
log in again, if the session hasnt replicated in time.

The other option I am looking at is to redirect to different contexts
from a generic login page... but I havent worked out how I can set
Apache up to map many different contexts to one.

Google Apps seems to do this.  See and then
"Click on" Sign in here, and enter a e.g. domain, It
redirects to a new context.


On Tue, Jun 15, 2010 at 5:50 PM, kiran surapaneni <> wrote:
> Hi,
>   I have several applications running on my tomcat server. But due to some
> reasons i need to move some of these applications to another tomcat server.
> But most of these applications are client-sever applications and hence i
> don't have the flexibility of making changes to the url. So the client will
> continue to type in the same url but tomcat should be able to forward the
> request to the appropriate server based on the url. Is this possible? And if
> yes, any clues on how to achieve this.
> Thanks in advance,
> Venkat

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message