Sorry folks, but you just have to have a horrible pun thrown at you from time to time!  All joking aside, today I worked on resolving a persistence issue to a few Citrix gateways that are load balanced by a BIG-IP® 6400.  I discovered that it is possible to use both a default persistence profile and to specify persistence in an iRule, all on the same Virtual Server.

Bearing in mind that I have the “Default Persistence Profile” set to use a profile other than cookie, here is the iRule that I wrote:

 set header_uri [string tolower [HTTP::uri]]
 if { [matchclass $header_uri starts_with $::aaa_uri] } {
 	pool aaa_Pool
 } elseif { [matchclass $header_uri starts_with $::bbb_uri] } {
 	HTTP::redirect ""
 } elseif { [matchclass $header_uri starts_with $::CITRIX_uri] } {
 	persist cookie insert "CITRIX_Cookie" "0d 03:00:00"
 	pool CITRIX_Pool
 } else {
   pool ccc_Pool

The command persist cookie insert “CITRIX_Cookie” “0d 03:00:00″, tells the BIG-IP® to create a cookie named CITRIX_Cookie, give it a duration of 3 hours and insert it into the header of traffic going to the CITRIX_Pool.  If traffic going to that pool already has the CITRIX_Cookie in its header then persist the connection to the same pool member that it used last time.

Traffic going to the rest of the pools will use whatever persistence method is set in the “Default Persistence Profile”.  It is also possible to disable persistence to pools by using the persist none command.


5 comments so far

Add Your Comment
  1. We have a situation where there are two web servers in a load balanced sitaution. The initial load balancing does fine and we use cookie persistence, but during an action on the web site a user may invoke an AJAX based page which does not take part in that same cookie and this causes a problem when that page comes from the other server. Is there a way through i-Rule or using another persistence profile that we can make this maintain on the same web server that the original session is created?

  2. You should probably use “One-Connect” or use “LB::detach” command in the iRule to inform F5 to load balance based on each request instead of the default load balancing per TCP Connection.

  3. We are running BIGIP version 10.2.4 with LTM.We are load balancing our ISP connections using BIGIP recently some users are complaining about the connection session issues.


    If a users is trying to connect to https website this will open session and goes to our ISP 1 and after some time the same user try to click on some other link on the same website it goes to ISP 2 so for the same website vendors are seeing two different IP’s because of this users are not able to complete any transactions.

    Can you please let me know where i can chek the issue in BIGIP and how to fix this issue.

  4. Hi There,

    Im trying to load test an application, which has 2 web-servers, an LTM and GTM. The issue is that the requests from Vusers(Virtual Users) are going to the single web server no matter how high the volume is. Please sugest me ways to get hits on both web servers.

  5. Hi , sounds like your sticky to one server . Check to see if you have persistence profile enabled on the VIP. Aslo check which load balancing alogrith you’re using .