Forum Discussion

Brent__Smith_28's avatar
Brent__Smith_28
Historic F5 Account
Jul 26, 2005

5XX Error Redirect

I am trying to help out a customer of mine that is trying to help a customer with an iRule that will re-load balance when a 5xx error is returned instead of returning the error to the end user. Has anyone put together an iRule like this or have a starting point? Thanks in advance. Brent

1 Reply

  • bl0ndie_127134's avatar
    bl0ndie_127134
    Historic F5 Account

    We have added two new rules that will allow you to do some thing like this on the next release of BigIP. If you have the TrafficShield beta, you should be able to try this out.

     

    
                  when HTTP_REQUEST {
                      if {[HTTP::method] == GET} {
                          set request [HTTP::request]
                      }
                  }
     
                  when HTTP_RESPONSE {
                      if {[info exists request] && ([HTTP::status] >= 500)}{
                          set server [LB::server addr]
                          HTTP::retry $request
                      }
                  }
      
                  when LB_SELECTED {
                      if {[info exits server] == 0} {
                          return
                      }
                      if {$server == [LB::server addr]} {
                          LB::reselect
                          set server ""
                      }
                  }

     

    For the current version of BigIP you will have to write a rule that looks like this.

     

    
    when HTTP_RESPONSE {
       if {[HTTP::status] >= 500} {
            HTTP::redirect "www.host.com/try/again/page"
       }
    }