Forum Discussion
The iRule delete cookies regardless of the cookies's name.
If HTTP request header has image value, I would like to delete the cookies in the HTTP request header regardless of the cookie's name.
So I made the following sample iRule;
when HTTP_REQUEST { if { [HTTP::header "Accept"] starts_with "image" } { HTTP::cookie remove "cookie name" } }
However, if the cookies named is random, how to modify above iRule?
Please help
Thank you
2 Replies
- kunjan
Nimbostratus
Will the header remove help?
when HTTP_REQUEST { HTTP::header remove Cookie } - Kevin_Stewart
Employee
If an HTTP request has any cookies, they'll all be in a single Cookie header.
GET / HTTP/1.1 Host: www.domain.com Cookie: foo=bar; test=blah; this=that;If you want to simply remove ALL of the cookies, then you simply remove the Cookie header as Kunjan showed. If you want to remove a specific cookie, then you need to parse the cookie header and strip out the specific key/value that you're looking for. It's also worth nothing that the above example will only remove the cookie header from the ingress flow. It'll have no effect on the client that still has and will continue to use the cookie unless either the application rewrites/deletes it, or you implement some iRule code to do the same.
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