Forum Discussion
Brad_Baker
Cirrus
Mar 10, 2022Clearing cookies for site with iRule
We believe we have some users with bad cookies on their system. Its not practical to ask all users to delete their cookies so we want to force them to expire with an f5 iRule. There is an HTTP::cook...
Brad_Baker
Cirrus
Mar 10, 2022I found another article which suggests I may need something more like this. What I am struggling with is how to check of the cookie_version2 cookie exists so we don't repeatedly expire all cookies. Any suggestions on how I can do that?
when HTTP_REQUEST {
set request_cookies [HTTP::cookie names]
}
when HTTP_RESPONSE {
foreach a_cookie $request_cookies {
log local0. "Remove cookie: $a_cookie"
HTTP::header insert Set-Cookie "$a_cookie=deleted;expires=Thu, 01-Jan-1970 00:00:10 GMT;path=/"
}
log local0. "Add cookie cookie_version=1 to track if the cookies have been cleared before or not"
HTTP::cookie insert name "cookie_version2" value "1" path "/"
HTTP::cookie attribute cookie_version2 value "expires" "Thu, 09-April-2022 00:00:00 GMT"
#log local0. "Add dummy cookie to see if cookie deletions is working"
#HTTP::cookie insert name "dummy_cookie" value "1" path "/"
#HTTP::cookie attribute dummy_cookie value "expires" "Thu, 09-April-2022 00:00:00 GMT"
}
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