Forum Discussion

Pranav_73262's avatar
Pranav_73262
Icon for Nimbostratus rankNimbostratus
Sep 30, 2013

Issue with cookie persistence

when HTTP_REQUEST {
    if { [string tolower [HTTP::path]] starts_with "/abcd" } {
        persist cookie insert "Portal_Cookie" "0d 00:00:00"
        pool Pool1
    } else {
        persist none
        pool Pool2
    }
}

=============

Above is the iRule which we are using for cookie persistence, will it insert new cookie on every request even though old cookie is present? TMOS is v 11.4.x

3 Replies

  • while testing, what we are observing is even though old cookie is present, it is responding with new cookie.
  • What do you want to accomplish?

     

    Do you have a cookie persistence profile assigned already and want to add a path specific cookie now?

     

    For testing only (!) I would recommend to turn off keepalive on your webservers and to remove the OneConnect profile on your virtual server.

     

    With OneConnect enabled connections will be kept open and any changes to your configuration (incl. iRule) will be applied to new connections only.

     

    Once you see stuff working as expected you should turn on the keepalive and apply the OneConnect profile of course.

     

  • Yes I think it will. I think what you need to do is check for the presence of the Cookie and not insert it if it's already present or, better yet, apply the Cookie persistence via a profile, assign a default pool (2) and change your iRule to this;

    when HTTP_REQUEST { 
     if { [string tolower [HTTP::path]] starts_with "/abcd" } { 
      pool Pool1 }
     else { 
      persist none }
    }