Forum Discussion

Rick_110395's avatar
Rick_110395
Icon for Nimbostratus rankNimbostratus
Sep 29, 2011

Persistence in an iRule

I have a virtual server with cookie persistence applied to the virtual server and and iRule that has cookie persistence applied in each condition. Since cookie persistence is applied to the virtual server can I remove the "persist cookie" statements from the iRule. See config below:

 

 

virtual virt-web-srv {

 

destination 10.10.50.33:http

 

ip protocol tcp

 

rules web-irule

 

persist cookie

 

profiles {

 

http {}

 

tcp {}

 

}

 

}

 

rule web-irule {

 

when HTTP_REQUEST {

 

set uri [HTTP::uri]

 

if {$uri contains "/prodweb"or $uri contains "/prodapp"} {

 

persist cookie

 

pool prod-web-pool

 

} elseif {$uri contains "/devweb" or $uri contains "/devapp"} {

 

persist cookie

 

pool dev-web-pool

 

} elseif {$uri contains "/testweb" or $uri contains "/testapp"} {

 

persist cookie

 

pool test-web-pool

 

} else {

 

HTTP::respond 404

 

}

 

}

 

}

 

2 Replies

  • Hi Rick,

     

     

    Yes. If the cookie persistence is configured on the Virtual Server then you can remove the "persist cookie" statements from your iRule.

     

     

    The BIG-IP will issue a cookie for each of the pools utilized by default when cookie persistence is configured on the Virtual Server.

     

     

    Hope this helps.