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"
}
}
}
}