Forum Discussion

ChrisK's avatar
ChrisK
Icon for Nimbostratus rankNimbostratus
Dec 01, 2009

iRule Question - persistance

I have a question regarding irules.

 

 

First off, is it possible to add persistence to a pool via a Virtual Server iRule?

 

 

Also, if so, how would this be accomplished? I’m still new with iRules.

 

 

Essentially what I am after is: in the old version 4 BigIPs, you could enable persistence on the pools, but now you can only via the VS (virtual server). We have a VS with an iRule which determines which pool to use, and 1 of the pools we would like to have persistence enabled. Can this be done by editing/enabling persistence for that pool in the iRule?

 

 

The type of persistence I would like to add is “Active HTTP Cookie Method: insert”.

 

 

If you could point me in the right direction that would be very appreciated.

 

4 Replies

  • Hi CK,

    You're correct in that in 4.x you could specify persistence per pool. Now in 9.x/10.x, persistence is set per VIP. You can use an iRule to make more granular persistence decisions.

    Take a look at this post for a close example:

    http://devcentral.f5.com/Default.aspx?tabid=53&view=topic&postid=33272&ptarget=33284

      
      when HTTP_REQUEST {  
        
          Check requested path  
         if {[HTTP::path] ends_with ".wav"}{  
        
             Use cookie persistence (session - no timeout) for this request  
            persist cookie insert my_persist_cookie 0  
         } else {  
             Use no persistence for this request  
            persist none  
         }  
      }  
      

    Aaron
  • Also check out http://devcentral.f5.com/wiki/default.aspx/iRules/persist.html for information about persist.

     

     

    Bhattman
  • ChrisK's avatar
    ChrisK
    Icon for Nimbostratus rankNimbostratus
    hi guys,

     

     

    i gave it a shot and i get the error message when trying to update the iRule

     

     

    "01070372:3: Persistence mode (Cookie) called out in rule requires a corresponding persistence profile for virtual server"

     

     

  • You'll need to add a blank cookie insert persistence profile to the VIP. The iRule then enables and configures or disables the cookie persistence profile according to your required logic.

     

     

    Aaron