Forum Discussion
Kevin_Stewart
Dec 08, 2012Employee
Taking inspiration from the following thread (https://devcentral.f5.com/community/group/aft/1178831/asg/52), here's a simple iRule that should get you in the right direction.
when RULE_INIT {
set static::DEBUG 1
}
when SERVER_CONNECTED {
Save the name of the currently connected pool (remove "/Common/" for v11 systems)
set pool_name [findstr [LB::server pool] "/Common/" 8]
if { $static::DEBUG } { log local0. "pool = $pool_name" }
}
when HTTP_RESPONSE {
Check if the response contains the persistence cookie
if { [HTTP::cookie BIGipServer${pool_name}] ne "" }{
if { $static::DEBUG } { log local0. "BIGIP cookie exists: [HTTP::cookie BIGipServer${pool_name}]" }
Replace the last Set-Cookie header value with the same value with HttpOnly and secure appended
HTTP::header replace Set-Cookie "[HTTP::header Set-Cookie]; httponly; secure"
}
}