httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomcatastrophe <>
Subject [users@httpd] Sticky sessions with Apache and Tomcat
Date Mon, 13 Jul 2009 17:22:43 GMT

I am trying to set up simple load balancing between Apache and two Tomcat
instances, but am having problems with sticky sessions.

I get thrown back and forth between the instances on each request. (I put a
note at the top of the page on each instance to distinguish where the page
has been served from and each request sends me back to the other server. I
see "instance 1" at the top of the page, then refresh and see instance 2,
then refresh and see instance 1 again, etc)

My Apache Virtual Host:

<VirtualHost *:80>
     DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Tomcat
     DirectoryIndex index.php

     <Directory "C:/Program Files (x86)/Apache Software Foundation/Tomcat
     Allow from all

     ProxyPreserveHost On
     ProxyPassReverse / ajp://
     ProxyPassReverse / ajp://
     ProxyPass / balancer://mycluster stickysession=JSESSIONID|jsessionid
     ProxyPass /balancer-manager !
     RewriteEngine On
     RewriteRule ^/(.*)$ balancer://mycluster/$1 [P,L,R]
<Proxy balancer://mycluster>
	BalancerMember ajp:// route=jvm1 loadfactor=50
	BalancerMember ajp:// route=jvm2 loadfactor=50
	ProxySet lbmethod=byrequests

<Location /balancer-manager>
        SetHandler balancer-manager
        Order Deny,Allow
        Deny from all
        Allow from


My two Tomcat instances are set up as:

    <Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm1">   


    <Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm2">   

Basically, what I want to happen is when I type in in the
browser I am taken to jvm1 instance, when I type the same thing in another
browser (new session) I am taken to jvm2 instance.

Then, everytime I visit any page on from either browser, I am always
served from the original instance I was assigned.

Any help?

View this message in context:
Sent from the Apache HTTP Server - Users mailing list archive at

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message