Forum Discussion

chic_cat_324145's avatar
chic_cat_324145
Icon for Altocumulus rankAltocumulus
Aug 23, 2017

Cookie stickiness doesn't work

Howdy, We're trying to set up stickiness with cookies. What we've done:

 

1.Added new cookie under persistence, current settings:

 

 

  1. Set cookie stickiness in virtual server

When I do a curl request

 

curl -v -X POST --cookie 'username=test' -u "test:test" * About to connect() to testweb port 8083 (0) * Trying 192.168.9.30... * Connected to testweb (192.168.9.30) port 8083 (0) * Server auth using Basic with user 'test'

 

POST /monitor HTTP/1.1 Authorization: Basic dGVzdDp0ZXN0Cg== User-Agent: curl/7.29.0 Host: testweb:8083 Accept: / Cookie: username=test

 

< HTTP/1.1 200 OK < Server: Apache-Coyote/1.1 < Content-Type: application/json < Transfer-Encoding: chunked < Date: Wed, 23 Aug 2017 05:57:23 GMT < * Connection 0 to host testweb left intact

 

In the logs, on web servers, I see that F5 does RR without stickiness.

 

All recommendations are appreciated. Thanks

 

2 Replies

  • You haven't specified the exact cookie persistence mechanism that you are seeking to implement. Have you looked into this - K83419154 ?

     

    If you are just looking for cookie persistence, "cookie insert" is a well-tested simple to implement mechanism.

     

  • Hi,

    cookie rewrite persistence will rewrite server response cookie named "username" with it's value containing pool member information...

    you can use this irule to configure Universal persistence with cookie value:

    when HTTP_RESPONSE {
      if { [HTTP::cookie exists "Username"] } {
        persist add uie [HTTP::cookie "Username"] 3600
      }
    }
    when HTTP_REQUEST {
      if { [HTTP::cookie exists "Username"] } {
        persist uie [HTTP::cookie "Username"] 3600
      }
    }