Forum Discussion
iRule cookie removal
Hello DevCentral Community,
First Question:I'm facing an issue with my iRule, I need to delete a cookie in the user browser if certain URI like "/logout" is requested.
Second Question: If I have multiple cookies with the same name like TestCookie but different values how i can delete all of them ?
Can you help me ?
Thanks in advance, Best Regards
2 Replies
- Arnaud_Lemaire
Employee
To remove the cookie you may use the max-age to 1 sec in a response when HTTP_REQUEST -> if uri logout set a var to 1
when HTTP_RESPONSE -> if var 1 set cookie maxage 1https://devcentral.f5.com/wiki/iRules.HTTP__cookie.ashx
if you have multiple cookie with the same name, you may need to to a foreach like in the example given in the former link.
- Arnaud_Lemaire
Employee
if you want to reset the cookie validity you just have to the same as before. 1) in HTTP_REQUEST if cookie exist set a var 2) in HTTP_RESPONSE you re apply a maxage on the cookie
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