Forum Discussion
BIG-IP : irule : ensure only a single instance of a cookie is present
F5 BIG-IP Virtual Edition v11.4.1 (Build 635.0) LTM on ESXi
I need to ensure that my response contains only a single instance of the the cookie
mycookie
and the value is set to 1
Will this work ?
when HTTP_RESPONSE {
if { [HTTP::cookie exists mycookie] } {
HTTP::cookie remove mycookie
}
HTTP::cookie insert name mycookie value 1
}
My tests seem to indicate that the remove command only removes a single cookie
mycookie
-- but it's difficult testing.
Also : by default are all request cookies automatically included in the response ( assuming no irule manipulation of cookies )
- Michael_JenkinsCirrostratus
I haven't tested this, so I'm not sure whether it will work properly, but you could use something like this below.
if { [HTTP::cookie exists mycookie] } { while { [HTTP::cookie exists mycookie] } { HTTP::cookie remove mycookie } HTTP::cookie insert name mycookie value 1 }
- nitassEmployee
I need to ensure that my response contains only a single instance of the the cookie mycookie and the value is set to 1
alternatively, you can just remove all the cookie named mycookie and then insert one with value 1 (i.e. no need to check first).
Recent Discussions
Related Content
* 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