Forum Discussion

Mark_Stradling_'s avatar
Feb 03, 2016

Removing Cookies from Client: Nothing seems to work....

I cannot get any of the cookie commands to remove cookies from the client. I want to have the F5 tell the client to remove cookies if they hit a certain URI. Here is what I have tried so far. None of it worked. I am not seeing any cookie response headers coming back

First try....

when HTTP_REQUEST {
    set cookies [HTTP::cookie names]
    some other stuff blah blah blah
    if {[HTTP::path] matches "/delete-my-cookies"} {
        set deletecookies 1
        return
    }
}
when HTTP_RESPONSE {
    if { deletecookies == 1 } {
        foreach cookie $cookies {
            HTTP::cookie remove $cookie
        }
    HTTP::respond 200 content "OK!"
    }
}

Second try....

when HTTP_REQUEST {
    set cookies [HTTP::cookie names]
    some other stuff blah blah blah
    if {[HTTP::path] matches "/delete-my-cookies"} {
        set deletecookies 1
        return
    }
}
when HTTP_RESPONSE {
    HTTP::cookie remove "cookie1"
    HTTP::cookie remove "cookie2"
    etc, etc
    HTTP::respond 200 content "OK!"
}

Third Try....

when HTTP_REQUEST {
    set cookies [HTTP::cookie names]
    some other stuff blah blah blah
    if {[HTTP::path] matches "/delete-my-cookies"} {
        set deletecookies 1
        return
    }
}
when HTTP_RESPONSE {
    HTTP::cookie insert name "cookie1" value "test_value" domain ".slce006.com"
    HTTP::cookie expires "cookie1" 1 absolute
    HTTP::cookie insert name "cookie2" value "test_value" domain ".slce006.com"
    HTTP::cookie expires "cookie1" 2 absolute
    HTTP::respond 200 content "OK!"
}

Any ideas? Basically I want the client to scrub all session cookies it has when it hits this URL so the client browser expires all cookies.

On BigIP Version 11.6