tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Jung <>
Subject Re: Sticky Session Not Working With Apache 2.0.54 and Tomcat 7.0.8
Date Fri, 29 Jul 2011 15:48:18 GMT
On 29.07.2011 16:34, Lataxes, Karl wrote:
> I believe this may what you requested.  The parameter information I extracted from the
request was contained in the request body, as well as the session ID I mentioned previously.
 If we need to include additional coding in both our servlet and client software, then it's
better we find out now.  

If you want an HTTP intermediate - like a reverse proxy - to implement
stickyness, it needs to extract session id info. Extracting from request
bodies is much more complex, than from headers or the request URI. So
out of the box most solutions only support the latter (or some cases of
it). This is especially true for Apache mod_proxy and mod_jk.



> URL: http://<host>:<port>/<servlet_path>/servlet/<servlet_name>/
> PATH: /
> HEADER: user-agent 'Java/1.6.0_16'
> HEADER: host '<host>:<port>'
> HEADER: accept 'text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2'
> HEADER: connection 'keep-alive'
> HEADER: content-type 'application/x-www-form-urlencoded'
> HEADER: content-length '134'
> PARAM: <parameter_name> '<parameter_value>'
> -----Original Message-----
> From: Rainer Jung [] 
> Sent: Friday, July 15, 2011 3:22 PM
> To:
> Subject: Re: Sticky Session Not Working With Apache 2.0.54 and Tomcat 7.0.8
> On 15.07.2011 18:19, Lataxes, Karl wrote:
>> We do not send cookies.
>> Our clients are not web pages but applications embedded in proprietary hardware,
which connect to our network via landline telephone or cell modem and access our servlet via
HTTP connection.  The servlet responds by sending a message containing several parameters
in name-value pair format, including a session id that appears as:  "session-id= <unique_client_identifier>-<current_time_in_milliseconds>".
 The client will respond to the servlet with a message that contains the same session id name-value
pair.  After initial connection, all client-server communications will contain this unique
session id name-value pair.
>> Apache will forward the requests/responses as expected when a single Tomcat node
is running.  However, for multiple nodes, the requests are forwarded round robin to all nodes.
 Our system environment prevents us from using session replication between nodes, so we have
to use sticky sessions.
>> I do not believe the problem is with Tomcat, but rather how mod_jk routes the requests.
 Is there any way to configure mod_jk so that it will recognize the session id name-value
> I did understand your question, but you still did not give the information hntains the
session id.
> The protocol spoken is HTTP and Apache is an HTTP server. So you need to get used to
the appropriate language in order to allow us to understand and give a correct answer. That's
why I suggested words as query parameters, path info, request headers etc.
> If the session id is send by the client as part of the request body, then it will become
complex and I currently see no solution without a bit of coding. If the id is in headers or
somewhere in the URL, you could likely design a solution using mod_proxy_balancer.
> Regards,
> Rainer
>> -----Original Message-----
>> From: Rainer Jung []
>> Sent: Friday, July 15, 2011 9:44 AM
>> To:
>> Subject: Re: Sticky Session Not Working With Apache 2.0.54 and Tomcat 
>> 7.0.8
>> On 15.07.2011 12:48, Lataxes, Karl wrote:
>>> Our servlet assigns a session id to a client when it initially contacts the server.
 The session id consists of "session-id", a unique client identifier, and the current time
in milliseconds, which is used as session identification for subsequent requests.  There are
numerous message exchanges between the servlet and client during a typical session, all of
which contain the session id.  Once the session has successfully ended, the session id is
removed from the servlet.  
>>> Is there any way we can configure mod_jk to recognize the session id in order
to route subsequent messages to the original Tomcat node it initially contacted?
>> How does the client present the session id as part of the requests?
>> Query parameter, path info, request header, cookie, ...?
>> Can you five a complete example?
>> Regards,
>> Rainer

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

View raw message