Forum Discussion
Brad_Baker
Mar 10, 2022Cirrus
I 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"
}