27-Aug-2021 10:00
Hi,
I need to delete specific cookie from client browser when APM session is closed. I found https://devcentral.f5.com/s/question/0D51T00006i7cT0/hot-to-delete-a-particular-cookiejsessionid-when-accesssessionclosed-event-is-trigered but looking on ACCESS_SESSION_CLOSED description it loos like "The iRule commands which require a flow context (for e.g. TCP, HTTP and SSL commands) can not be used in this event".
Indeed, if I am trying iRule from other topic:
when ACCESS_SESSION_CLOSED {
HTTP::cookie expires "JSSIONID" 0 absolute
HTTP::cookie expires "LtpaToken2" 0 absolute
}
It gives me error "command is not valid in current event context ".
Any help will be greatly appreciated.
27-Aug-2021
12:34
- last edited on
21-Nov-2022
15:55
by
JimmyPackets
Hello Dmitriy.
Try this code:
when ACCESS_SESSION_CLOSED {
HTTP::header insert "Set-Cookie" "MyCookie=deleted;expires=Thu, 01-Jan-1970 00:00:01 GMT;path=/"
}
Regards,
Dario.
30-Aug-2021 08:34
Thank you for suggestion, Dario but it is the same problem. When I am trying to create suggested iRule, F5 tells me: command is not valid in current event context (ACCESS_SESSION_CLOSED)][HTTP::header insert "Set-Cookie" "MyCookie=deleted;expires=Thu, 01-Jan-1970 00:00:01 GMT;path=/"]
It is pretty much aligned with what documentation says about ACCESS_SESSION_CLOSED event The iRule commands which require a flow context (for e.g. TCP, HTTP and SSL commands) can not be used in this event"
30-Aug-2021 08:37
Still looking for the possible solution. Any help will be greatly appreciated.
30-Aug-2021
11:15
- last edited on
21-Nov-2022
15:57
by
JRahm
Hi Dmitriy,
Can you try this iRule?
when CLIENT_ACCEPTED {
set status 0
}
when ACCESS_SESSION_CLOSED {
set status 1
}
when HTTP_RESPONSE_RELEASE {
if { $status } {
HTTP::cookie expires "JSSIONID" 0 absolute
HTTP::cookie expires "LtpaToken2" 0 absolute
}
}
01-Sep-2021 12:45
HI Enes,
Thank you for suggestion. I will look into your suggestion.