Forum Discussion

F5workuserguy's avatar
F5workuserguy
Icon for Altostratus rankAltostratus
Jun 28, 2021

maintenance iRule with 404

is there a better way to write this?\

 

=====================================================

when LB_FAILED {

    if { [active_members [LB::server pool]] != 0 } {

} else {

    HTTP::fallback "https://maintenance.google.com"

  }

}

when HTTP_RESPONSE {

  if { [HTTP::status] == "404" } {

    HTTP::respond 302 noserver Location "https://maintenance.google.com"

  }

}

=====================================================

1 Reply

  • Hello F5workuserguy.

    Try this:

    when HTTP_REQUEST {
      if { [active_members [LB::server pool]] < 1 } {
        HTTP::respond 302 noserver Location "https://maintenance.google.com"
      }
    }
     
    when HTTP_RESPONSE {
      if { [HTTP::status] == "404" } {
        HTTP::respond 302 noserver Location "https://maintenance.google.com"
      }
    }

    Regards,

    Dario.