Forum Discussion

Sabir_Alvi's avatar
Sabir_Alvi
Icon for Altocumulus rankAltocumulus
Aug 31, 2018

Custom Message using iRule for Runtime Error

Our application throws a runtime error during few code testing in our Test lab. We do not want this error to be displayed when browsed externally via internet. I'm looking for an iRule that will present a custom message like 'Oops' whenever web server returns below error message -

 

Server Error in '/' Application. Runtime Error

 

  • In my opinion, use a custom page for all types of server-side errors. Server sides errors start with 5xx. Use this irule:

    when HTTP_RESPONSE { 
        if { [HTTP::status] > 499 } { 
            HTTP::respond 200 content "Oops Unfortunately, your request casued a error." "Content-Type" "text/html" 
        } 
    }