Forum Discussion
Moinul_Rony
Altostratus
Sep 25, 2013custom error page based on /URI
Hi I have a iRule on our application server that is catching all 4xx and 5xx error responses and responds with a custom response using the below iRule. We have some application that has inbuilt error...
Kevin_Stewart
Employee
Sep 25, 2013Without rebuilding your entire iRule, the logic for such a requirements might look like this:
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] starts_with "/uri" } {
set noerror 1
}
}
when HTTP_RESPONSE {
if { ( ( [HTTP::status] starts_with "4" ) or ( [HTTP::status] starts_with "5" ) ) and not ( [info exists noerror] ) } {
HTTP::respond 200 content "..."
}
}
This will set a variable in the HTTP_REQUEST event if a specific URI is requested, which will be visible in the corresponding HTTP_RESPONSE event. If users might flip between applications in a single connection, you can optionally add the following to the bottom of the HTTP_RESPONSE event to clear the variable between requests if it exists:
if { [info exists noerror] } { unset noerror }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects