Jump to content
Welcome to our new Citrix community!

Persistence Rule JSESSIONID


Recommended Posts

HI,

can someone explane session persistence rule JSESSIONID to me?

 

-rule “HTTP.REQ.COOKIE.VALUE(\”jsessionid\”) ALT HTTP.REQ.URL.BEFORE_STR(\”?\”).AFTER_STR(\”;jsessionid=\”) ALT HTTP.REQ.URL.AFTER_STR(\”;jsessionid=\”)”

-resRule “HTTP.RES.SET_COOKIE.COOKIE(\”jsessionid\”).VALUE(\”jsessionid\”)”

 

What do the rule and what do the resRule?

Link to comment
Share on other sites

The "rule" is for inbound traffic (from client to Netscaler). The Netscaler uses this expression for determining the session persistence ID from the request. The ID is then used so that the Netscaler knows which backend server to send traffic to.

 

The "resRule" is for the response traffic that comes back from the backend server to the Netscaler, before it is sent to the client. The Netscaler uses this expression for determining if the server that the traffic was sent to is setting a session persistence ID. The ID will be used by the Netscaler so that subsequent requests that come in will be sent to the same backend server.

 

Example:

  1. Client request without session header -> Netscaler.
    1. Netscaler sends request to random server based on fallback persistence method -> backend server A is chosen.
    2. Backend server A sends response -> netscaler with jsessionid=123 in "set_cookie" response header.
    3. Netscaler knows to save backend server A as the server that should be used when subsequent requests with cookie value jsessionid=123.
    4. Netscaler sends response back to client.
  2. Client request with jsession=123 in header cookie -> Netscaler.
    1. Netscaler knows that backend server A is associated with jsessionid=123. Netscaler sends traffic to backend server A.

 

This is common in web applications where sessions that are initiated on one server need to use that same server for all subsequent requests.

 

See also these articles for detail:

 

Hope that helps!

  • Like 4
Link to comment
Share on other sites

16 hours ago, Ross Bender said:

The "resRule" is for the response traffic that comes back from the backend server to the Netscaler, before it is sent to the client. The Netscaler uses this expression for determining if the server that the traffic was sent to is setting a session persistence ID. The ID will be used by the Netscaler so that subsequent requests that come in will be sent to the same backend server.

 

Just to clarify...

So that means, NetScaler isn't setting any Jsession Cookies in this configuration. right?

I'm thinking of the situation a client is sending a JSESSIONID within the URL part.

 

If netscaler is aware to look also into the url part does he set this JSESSOION also into the cookie part because of the resprule?
 

Link to comment
Share on other sites

On 3/19/2020 at 3:46 AM, Eduard Hampuumlbner said:

What happens if a client is sending two JessionID cookies for the same path?
Will NS take account for both cookies and choose the correct backend if one JSESSIONID is present in the persistence table, but the second ID isn't?

 

I would guess the Netscaler will use the first JSESSIONID it matches from the policy. It should be easy enough to test for your setup.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...