You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Assaf Flatto <as...@atelis.net> on 2006/11/06 10:51:04 UTC

Re: changing the length of the jsessionid

I took the sources of the 5.0.30 tomcat and made the changes, recompiled 
the RPM and installed it on  one of my QC servers .
the session id that is generated from the tomcat is indeed 30 chars but 
now it seems that the jvmroute and the balancer in front of it are not 
adding the ".x" to the jsessionid .


my balancer config is :

ProxyPass / balancer://mycluster/  lbmethod=bytraffic 
stickysession=jsessionid nofailover=Off
   <Proxy balancer://mycluster >
        BalancerMember ajp://172.31.1.1:8081 ttl=60  route=1
#        BalancerMember http://172.31.1.2:8080 ttl=60  route=2
#        BalancerMember ajp://172.31.1.3:8080 ttl=60  route=3
        Order Allow,Deny
        Allow from all
    </Proxy>


I specifically changed the ajp port to 8081 - it is not an error , the 
connector on the tomcat is defined :

<Connector port="8081" enableLookups="false" redirectPort="8443" 
protocol="AJP/1.3" />

and the jvmroute is defined :
 
<Engine name="Catalina" defaultHost="www.foo.com" debug="0" jvmroute="1">

but the end result is  cookie: JSESSIONID=FB5B5218F8A9021652FDE8C270F991

any guess why that is ?


Thanks


Christopher Schultz wrote:
> Assaf,
>
>   
>> Does anyone know how i can shorten the length of the jsessionid from 32
>> chars to 30 ?
>>     
>
> In Tomcat 4.1, the class org.apache.catalina.session.ManagerBase creates
> sessions and assigns ids to them. The source I'm looking at right now
> uses a message digest algorithm (it's not clear which one, but probably
> MD5) which returns a fixed-width string.
>
> I suppose you could modify this file directly and re-package it with
> your deployment, or possibly even subclass it and somehow install it
> without having to modify Tomcat's internals (I don't know how to specify
> which Manager gets used by Tomcat... someone else will have to answer that).
>
> Any particular reason you want to shorten the session id?
>
> -chris
>
>
>   

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: changing the length of the jsessionid

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Assaf,

Assaf Flatto wrote:
> now it seems that the jvmroute and the balancer in front of it are
> not adding the ".x" to the jsessionid.

[snip]

> but the end result is  cookie:
> JSESSIONID=FB5B5218F8A9021652FDE8C270F991

Perhaps the proxy module is looking for the pattern
";JSESSIONID=[0-9A-F]{32}" instead of any number of characters in the
session id. That would certainly trip things up. You may have to modify
the code to the proxy module, too. ?? (That would really suck, I'm sure).

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFTz3x9CaO5/Lv0PARAmSwAJ9YRpuKnUkKB+bQ+g5jWUhh8HTbKgCcC15r
wCLxZutIEQpqZvZ89cT+yL4=
=seqp
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: changing the length of the jsessionid

Posted by Mark Thomas <ma...@apache.org>.
Assaf Flatto wrote:
> I took the sources of the 5.0.30 tomcat and made the changes, recompiled
> the RPM and installed it on  one of my QC servers .
> the session id that is generated from the tomcat is indeed 30 chars but
> now it seems that the jvmroute and the balancer in front of it are not
> adding the ".x" to the jsessionid .

Tomcat 5 has sessionIdLength in the StandardManager - see
http://tomcat.apache.org/tomcat-5.5-doc/config/manager.html

If your current approach doesn't work you could
- upgrade to 5.5.x and use the built-in functionality
- port the relevant code from 5.5.x to a custom manager

Mark


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org