Forum Discussion

suthomas1's avatar
suthomas1
Icon for Cirrostratus rankCirrostratus
Aug 24, 2020

client request rule

Good day all,

 

We have recently taken over a subsidary of ours and f5 is one of their devices.

In a virtual service, this irule is found. I am trying to understand what this does with the virtual server traffic.

 

Please help me to understand what this is used for. The service is an https that converts the client requests to another port on the pool member.

( some of these have been slightly changed here for discreet purpose)

 

 

when CLIENT_ACCEPTS {

  set retry 0

}

 

when HTTP_REQUEST {

  set http_request [HTTP::request]

}

 

when HTTP_RESPONSE {

  if { ([HTTP::status] starts_with "4")} {

    incr retry

    if { $retry <= [active_members [LoB::pool]] } {

      HTTP::retry $http_request

    } else {

      set retry 0

    }  

 

  } else {

    set retry 0

  }

}

 

when ltm-pass {

  if { ($retry > 0) && ($retry <= [active_members [LoB::pool]])} {

    LB::reselect pool [LoB::pool]

      log local0.info "New LB server is [LoB::xyz]"

  }

}

 

when ltm-fail {

if { $retry <= [active_members [LoB::pool]]} {

incr retry   

LoB::reselect pool [LoB::pool]

}   

}

 

  • The very short summary: this iRule will (1) force an HTTP request to be resent if it initially receives a 4xx level response from the server (2) log the pool member that is selected after the first request fails and it retries (3) try selecting a new pool member if the first one fails.

     

    LB::reselect

    HTTP::retry

     

  • The very short summary: this iRule will (1) force an HTTP request to be resent if it initially receives a 4xx level response from the server (2) log the pool member that is selected after the first request fails and it retries (3) try selecting a new pool member if the first one fails.

     

    LB::reselect

    HTTP::retry