Forum Discussion
Clearing cookies for site with iRule
Hi, I've achieved a similar thing recently to delete APM cookies and restart session. I can confirm the only way to delete cookies on client side is forcing them to expire. Try to see if my code snippet helps you. Also, I'm only removing cookies for specific domain since that was what I needed for my environment, use browser tools to determine whether you need this or not.
when HTTP_REQUEST {
set refererfound 0
if {[string tolower [HTTP::header value Referer]] eq "<censored>"}{
set refererfound 1
HTTP::header replace Referer ""
set reqcookies [HTTP::cookie names]
foreach cookie $reqcookies {
HTTP::cookie remove $cookie
}
}
}
when HTTP_RESPONSE_RELEASE {
if {$refererfound eq 1}{
foreach acookie $reqcookies {
HTTP::header insert Set-Cookie "$acookie=deleted; domain=<censored>; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/"
}
}
}
hey, I'm trying something similar, so if I want to do it for just 1 domain do I just replace your if condition to match the HTTP host? The domain is simple like example.com
if {[string tolower [HTTP::header value Referer]] eq "<censored>"}{ #replace with HTTP host instead of referer here? Will that work?
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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