Forum Discussion
Otto_Schmedlap_
Nimbostratus
Jul 03, 2006HTTP:cookie doesn't remove with 401 response
I've found that when the server responds with a 401 error my code to remove a cookie does not get sent to the client.
Is that normal functionality for the client to ignore removing a cookie if it is sent a 401 error?
2 Replies
- Colin_Walker_12Historic F5 AccountCould you post your rule so we can see what it is you're doing?
Colin - Otto_Schmedlap_
Nimbostratus
Sorry I didn't include the iRule earlier.
I'm just trying to determine the last website I hit(by looking for the HTTP::Header=XYZthewebsite from the web server) to ensure it is the next one I goto until the iRule matches known URIs not on that server. When the URI matches on those other known URIs(like "/" or "/default.aspx") i need to go to another pool until the next time I match on URI="/sites".
However the client continues to respond with the cookie even after I've sent the remove cookie. The only thing I thought was it is related to the 401 response from the server on the request for "/" or "/default.aspx".
----IRULE ----
when HTTP_REQUEST {
log "logging working"
Don't allow data to be chunked
if { [HTTP::version] eq "1.1" } {
if { [HTTP::header is_keepalive] } {
HTTP::header replace "Connection" "Keep-Alive"
}
HTTP::version "1.0"
}
if { [HTTP::cookie exists "XYZWSS"] } {
log "cookieexists = yes"
set XYZwsscookie 1
}
else {
log "cookieexists = no"
set XYZwsscookie 0
}
set myURI [string tolower [HTTP::uri]]
if { $myURI equals "/" } {
log "uri=slash"
set XYZwsscookie 0
HTTP::uri "/default.aspx"
pool theweb02-80
}
elseif { $myURI equals "/default.aspx" } {
log "uri=default.aspx"
set XYZwsscookie 0
pool theweb02-80
}
elseif { $myURI starts_with "/sites/" } {
log "uri=sites"
pool thewebsites02-80
}
elseif { $XYZwsscookie } {
log "XYZwsscookie variable = 1"
pool thewebsites02-80
}
else {
log "hit final else"
pool theweb02-80
}
}
when HTTP_RESPONSE_DATA {
if { [HTTP::header exists "XYZthewebsite"] }{
log "found header from web server"
HTTP::cookie remove "XYZWSS"
HTTP::cookie insert name "XYZWSS" value "1.0" path /
}
elseif { not($XYZwsscookie) }{
log "no header XYZcookie"
HTTP::cookie expires "XYZWSS" "1"
set cookies [HTTP::cookie names]
foreach aCookie $cookies {
if { [string tolower $aCookie] matches_regex "XYZWSS" } {
HTTP::cookie expires "XYZWSS" "1"
HTTP::cookie remove "XYZWSS"
}
}
}
else {
log "no header from web server"
HTTP::cookie expires "XYZWSS" "1"
set cookies [HTTP::cookie names]
foreach aCookie $cookies {
if { [string tolower $aCookie] matches_regex "XYZWSS" } {
HTTP::cookie expires "XYZWSS" "1"
HTTP::cookie remove "XYZWSS"
}
}
}
}
when HTTP_RESPONSE {
if { [HTTP::header exists "XYZthewebsite"] }{
log "found header from web server"
HTTP::cookie remove "XYZWSS"
HTTP::cookie insert name "XYZWSS" value "1.0" path /
}
elseif { not($XYZwsscookie) }{
log "no header XYZcookie"
HTTP::cookie expires "XYZWSS" "1"
set cookies [HTTP::cookie names]
foreach aCookie $cookies {
if { [string tolower $aCookie] matches_regex "XYZWSS" } {
HTTP::cookie expires "XYZWSS" "1"
HTTP::cookie remove "XYZWSS"
}
}
}
else {
log "no header from web server"
HTTP::cookie expires "XYZWSS" "1" absolute
set cookies [HTTP::cookie names]
foreach aCookie $cookies {
if { [string tolower $aCookie] matches_regex "XYZWSS" } {
HTTP::cookie expires "XYZWSS" "1" absolute
HTTP::cookie remove "XYZWSS"
}
}
}
}
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
