1 Reply Latest reply on Apr 2, 2015 4:41 AM by Jean-Frederic Clere

    mod_cluster sticky session cookie name configuration?

    John Petersen Newbie


      I'm using mod_cluster(1.2.0.Final) to dynamically add Tomcat instances to our httpd(2.2.26) load balancer. I am running standalone instances (no session replication) but they keep session state so the load balancer must be sticky. I followed the mod_proxy_balancer and mod_cluster docs for setting up httpd and Tomcat. Running with the default session cookie name works great. New clients are sent to a Tomcat box and are stuck there for the duration of their session.

      The problem is I need to use a custom session cookie name. When configured following as shown below the load balancer no longer knows where to route the requests and sessions are lost.


      Tomcat server.xml:

        <Listener className="org.jboss.modcluster.container.catalina.standalone.ModClusterListener"







                  stickySessionRemove="false" />


      Tomcat context.xml:

        <Context antiJARLocking="true" swallowOutput="true" unpackWAR="true" sessionCookieName="SIDBP">



        <IfModule manager_module>


          MemManagerFile /opt/mod_cluster-current/manager

          CreateBalancers 1

          ProxyPassMatch /server-status !

          ProxyPassMatch /server-info !

          ProxyPass / balancer://brokerb/ stickysession=SIDBP|sidbp

          Maxcontext 300

          Maxnode 150

          Maxhost 300

          <Location /mod_cluster_manager>

                SetHandler mod_cluster-manager

                Order deny,allow

                Deny from all

                Allow from 10

                AllowDisplay On

                AllowCmd off



            <Location />

             Order deny,allow

             Deny from all

             Allow from all



            KeepAliveTimeout 300

            MaxKeepAliveRequests 0





      Tomcat is configured to use the custom session cookie name correctly because the session is maintained when bypassing the load balancer and hitting a single node directly.


      Logging was turned up on Apache to see the stickiness related values. When using the default JSESSIONID it is reported correctly in BALANCER_SESSION_STICKY. However when using the custom cookie SIDBP nothing is reported for BALANCER_SESSION_STICKY and BALANCER_ROUTE_CHANGED is always 1.


      Mod Cluster Manager Dumps this info. It does not seem to be picking up the cookie name.


      balancer: [1] Name: brokerb Sticky: 1 [JSESSIONID]/[jsessionid] remove: 0 force: 0 Timeout: 0 maxAttempts: 1

      node: [1:1],Balancer: brokerb,JVMRoute: ea-tc0102,LBGroup: [],Host:,Port: 8009,Type: ajp,flushpackets: 0,flushwait: 10,ping: 10,smax: 65,ttl: 60,timeout: 0

      node: [2:2],Balancer: brokerb,JVMRoute: ea-tc0103,LBGroup: [],Host:,Port: 8009,Type: ajp,flushpackets: 0,flushwait: 10,ping: 10,smax: 65,ttl: 60,timeout: 0

      host: 1 [localhost] vhost: 1 node: 1

      host: 2 [localhost] vhost: 1 node: 2

      context: 1 [/] vhost: 1 node: 1 status: 1

      context: 2 [/] vhost: 1 node: 2 status: 1


      What am I missing? How is the session cookie name configured when using mod_cluster versus mod_proxy_balancer?