I have client requests that are initiated through a Load balancer and routed to the least weighted Tomcat server to process.
When the client hits a target Tomcat server, the response to the client contains absolute URL's to be used for the second request. This essentially eliminates the load balancer to allow the client to communicate directly with the Tomcat instance for the life of the client session.
ISSUE: The issue is that the first request through the load balancer is creating a SESSION, then the second request directly to Tomcat creates a second SESSION for a single client. The first SESSION is just unused and expires eventually.
QUESTION: How can I connect the client on the second request, back to the SESSION that was created on the first request (through the load balancer)?
UPDATE: I tested this in JMeter and did not have any luck connecting the sessions.
Request one:
http://loadbalancer:80/page1.jsp
Response header:
Set-Cookie: JSESSIONID=070894D435A46DF60AFE506018018325; Path=/
Then the second request is:
http://directTomcat:8080/page2.jsp?token1=123&token2=xyz;JSESSIONID=070894D435A46DF60AFE506018018325
[no cookies]
Second Response headers:
Set-Cookie: JSESSIONID=1081A016CBA9B3AA7E7C38EF775C04F7; Path=/
I also tried:
http://directTomcat:8080/page2.jsp?token1=123&token2=xyz&JSESSIONID=070894D435A46DF60AFE506018018325
but that also did not work either.
Is it necessary to set the JSESSIONID as a cookie on the client before making the second request?