Forum Discussion
rajb
Nimbostratus
Feb 14, 2023Trying to find a way to delete cookie with a domain name using irule
Hello, I'm trying to delete cookie that have a domain name set. For example in the below pciture, there are cookies with domain name reddit, let's say I'd like to delete it with an irule ...
Paulius
MVP
Feb 15, 2023rajb What happens if you add the following just before you "Domain name is:" logging line?
log local0. "Cookie name is: ${cookie_name}"rajb
Nimbostratus
Feb 16, 2023Paulius This the updated irule and the output
when HTTP_REQUEST {
# Check if we have already deleted the cookies
log local0. "Running within HTTP_REQUEST"
if {not [HTTP::cookie exists tracking_cookie]} {
log local0. "Running within tracking_cookie"
# Define an array of cookie names to delete
set cookie_names [list "loadedFromBrowserCache" "_gid" "_ga" "GuysOnlineFilter" "CruisingListingsFilter" "notifycached"]
foreach cookie_name $cookie_names {
set cookieDomain [HTTP::cookie domain "${cookie_name}"]
log local0. "Executing cookie: ${cookie_name}"
log local0. "Domain name is: ${cookieDomain}"
}
}
}
Feb 16 10:15:28 lb1.ptp.local info tmm1[19397]: Rule /Common/delete_cookie_test <HTTP_REQUEST>: Running within HTTP_REQUEST
Feb 16 10:15:28 lb1.ptp.local info tmm1[19397]: Rule /Common/delete_cookie_test <HTTP_REQUEST>: Running within tracking_cookie
Feb 16 10:15:28 lb1.ptp.local info tmm1[19397]: Rule /Common/delete_cookie_test <HTTP_REQUEST>: Executing cookie: loadedFromBrowserCache
Feb 16 10:15:28 lb1.ptp.local info tmm1[19397]: Rule /Common/delete_cookie_test <HTTP_REQUEST>: Domain name is:
Feb 16 10:15:28 lb1.ptp.local info tmm1[19397]: Rule /Common/delete_cookie_test <HTTP_REQUEST>: Executing cookie: _gid
Feb 16 10:15:28 lb1.ptp.local info tmm1[19397]: Rule /Common/delete_cookie_test <HTTP_REQUEST>: Domain name is:
Feb 16 10:15:28 lb1.ptp.local info tmm1[19397]: Rule /Common/delete_cookie_test <HTTP_REQUEST>: Executing cookie: _ga
Feb 16 10:15:28 lb1.ptp.local info tmm1[19397]: Rule /Common/delete_cookie_test <HTTP_REQUEST>: Domain name is:
Feb 16 10:15:28 lb1.ptp.local info tmm1[19397]: Rule /Common/delete_cookie_test <HTTP_REQUEST>: Executing cookie: GuysOnlineFilter
Feb 16 10:15:28 lb1.ptp.local info tmm1[19397]: Rule /Common/delete_cookie_test <HTTP_REQUEST>: Domain name is:
Feb 16 10:15:28 lb1.ptp.local info tmm1[19397]: Rule /Common/delete_cookie_test <HTTP_REQUEST>: Executing cookie: CruisingListingsFilter
Feb 16 10:15:28 lb1.ptp.local info tmm1[19397]: Rule /Common/delete_cookie_test <HTTP_REQUEST>: Domain name is:
Feb 16 10:15:28 lb1.ptp.local info tmm1[19397]: Rule /Common/delete_cookie_test <HTTP_REQUEST>: Executing cookie: notifycached
Feb 16 10:15:28 lb1.ptp.local info tmm1[19397]: Rule /Common/delete_cookie_test <HTTP_REQUEST>: Domain name is:Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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