Forum Discussion

lfernandez's avatar
lfernandez
Icon for Nimbostratus rankNimbostratus
Oct 09, 2023

Delete cookie from client when a pool member is disabled

Hi everyone

I have configure the health monitor from a pool in order to disable a member when getting a HTTP 404 status code.

The virtual server linked to this pool includes cookie persistence but I'm not able to redirect the requests to the pool active's nodes unless the cookie from the browser would be deleted.

I've tried the next iRule with no luck. Can anyone help me? Thanks in advance

 

when CLIENT_ACCEPTED {
    # Init retried requests per each TCP connection
    set retries 0
    
    # Save virtual server default pool name
    set default_pool [LB::server pool]
}

when HTTP_REQUEST {
    # Save the  GET client request if this is not a retried request
    if { [HTTP::method] eq "GET" && $retries == 0 }{
      set request_headers [HTTP::request]
      #log local0. "Saving HTTP request headers: $request_headers"
   }
}

when LB_SELECTED {
   # Select a new pool member from the VS default pool if we are retrying this request
   if { $retries > 0 } {
      LB::reselect pool $default_pool
   }
}

when HTTP_RESPONSE {
    if { [HTTP::status] eq "404" } 
        { 
            incr retries
            set cookies [HTTP::cookie names]
            
            if { $retries < [active_members $default_pool]}
            {
                foreach aCookie $cookies {
                    if {$aCookie contains "BIGipServerService_"} {
                        # Remove BIGipCookie
                        HTTP::cookie remove $aCookie
                        log local0. "Removed cookie $aCookie"
                    }
                }
            
                HTTP::retry $request_headers
                return
            }
            
        }
        
    set retries 0
}

 

 

    • lfernandez's avatar
      lfernandez
      Icon for Nimbostratus rankNimbostratus

      Hi Paulius ! Actually, I've tried all possible values with no luck. I've understood that this option was related to the pool but the pool remains active even though one of its members would be disabled.

      Thanks in advance!