Forum Discussion

Robert_47833's avatar
Robert_47833
Icon for Altostratus rankAltostratus
Oct 31, 2012

small question in "persist"

virtual test {

 

snat automap

 

destination 1.1.1.1:http

 

ip protocol tcp

 

rules test-irule

 

profiles {

 

http {}

 

oneconnect {}

 

tcp {

 

serverside

 

}

 

}

 

}

 

}

 

 

here is the question,I want http request going through this vip can persisit via one cookie in the http head,let 'us say it as cookie-1,I don't need bigip add this cookie for me ,it is already there,

 

 

due to some reason,I can't add profile in this vip,I only want to use irule to achiveve,

 

it seems cookie hash is not a bad choice

 

 

would u like show me how to achieve this?

 

 

 

 

 

4 Replies

  • is universal persistence applicable?

     

     

    sol7392: Overview of universal persistence

     

    http://support.f5.com/kb/en-us/solutions/public/7000/300/sol7392.html
  • I think you'd need to add a cookie persistence profile to use any of the persist cookie iRule commands. The simplest solution from a BIG-IP perspective would be to use cookie insert so BIG-IP doesn't need to track any sessions in its memory. If it really isn't an option to add a persistence profile, you could use persist uie from an iRule:

    
     from: https://devcentral.f5.com/wiki/iRules.Weblogic_JSessionID_Persistence.ashx
    when HTTP_REQUEST {
        Log details for the request
       set log_prefix "[IP::client_addr]:[TCP::client_port]"
       log local0. "$log_prefix: Request to [HTTP::uri] with cookie: [HTTP::cookie value my_cookie]"
    
        Check if there is a my_cookie cookie
       if { [HTTP::cookie "my_cookie"] ne "" }{
           Persist off of the cookie value with a timeout of 1 hour (3600 seconds)
          persist uie [string tolower [HTTP::cookie "my_cookie"]] 3600
    
           Log that we're using the cookie value for persistence and the persistence key if it exists.
          log local0. "$log_prefix: Used persistence record from cookie. Existing key? [persist lookup uie [string tolower [HTTP::cookie "my_cookie"]]]"
       }
    }
    when HTTP_RESPONSE {
        Check if there is a my_cookie cookie in the response
       if { [HTTP::cookie "my_cookie"] ne "" }{
           Persist off of the cookie value with a timeout of 1 hour (3600 seconds)
          persist add uie [string tolower [HTTP::cookie "my_cookie"]] 3600
    
          log local0. "$log_prefix: Added persistence record from cookie: [persist lookup uie [string tolower [HTTP::cookie "my_cookie"]]]"
       }
    }
    

    Aaron
  • hi,Aaron

     

    yes,I don't have option to use persistence profile which is applied to VIP

     

    what is needed for this persist uie?

     

    it seems your example is add a new uie persistence?

     

    correct me if I am wrong
  • actually this cookie-1 is added by me in irule in http response event

     

     

    they want to send request to the node if it is sent to that node before with the cookie-1 in it

     

    cookie-1 is customized.