Forum Discussion

Abdulaziz1's avatar
Abdulaziz1
Icon for Nimbostratus rankNimbostratus
Jul 24, 2023

Remove all Cookies incase based on specific condition

We've a requimrent to flush all cookies from the user session incase a user deleted one cookie from client browser.

why such request, our web servers have some security restrictions to have both cookies in reqeust for session to be valid "JSESSIONID & LtpaToken2".

incase a user deleted "LtpaToken2", then the "JSESSIONID" must be deleted else user will get the web server error code.

Please need your support to suggest the way to flush all cookies incase LtpaToken2 is removed and if we can add more condiations such as : refere contains /wps/portal/.

we've tried below but didn't work:

when HTTP_REQUEST {
if { ( [HTTP::uri] starts_with "/wps/myportal/" ) and ( [HTTP::cookie exists "JSESSIONID"] ) and ( not [HTTP::cookie exists "LtpaToken2"] ) } {
log local0. "Remove cookie JSESSIONID From Request as LtpaToken2 is not present"
HTTP::cookie remove "JSESSIONID"
HTTP::redirect https://www.mysite.com/landing.html
}

}

4 Replies