Forum Discussion
gavin84_31753
Nimbostratus
Dec 07, 2012Secure and HTTP attribute setting on BIGIP cookie in Persistence Profile
So I'm in need of an IRULE to set HTTP Only and secure flags on the cookie that we are using in our cookie persistence profile, call it BIGIP. I did some research and found this one on dev central, ...
Kevin_Stewart
Employee
Dec 08, 2012Taking 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"
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects