Forum Discussion
Maintenance page per status code received
Im trying to find an iRule that can do a maintenance page depending on what status code is given... for example:
status code 3xx - go to maintenance page 1 - "Your request has been redirected"
status code 4xx - go to maintenance page 2 - "Your request has received a client error"
status code 5xx - go to maintenance page 3 - "Your request has received a server error"
Im using a basic/simple maintenance page:
when HTTP_REQUEST {
Check and verify that there are Pool Members Available to server the request
if { [active_members [LB::server pool]] < 1 } {
If there are no members available, generate HTML Maintenance Page
HTTP::respond 200 content "Site unavailable
System Maintenance
NOTICE: This site is under maintenance.
"
}
}
Im hoping to find a simple solution to use the response code results and give them a html response with simple text that is hosted by the F5. The fallback host setup will not work for this request.
2 Replies
- Moe_Jartin
Cirrus
So your irule will work as-is for when there are no servers available. Now you need to look at the responses when there ARE servers and intercept/replace that response. So just add this to the bottom of your iRule.
when HTTP_RESPONSE { switch [HTTP::status] { "3*" { HTTP::respond 200 content "Your 3xx content here" } "4*" { HTTP::respond 200 content "Your 4xx content here" } "5*" { HTTP::respond 200 contetn "Your 5xx content here" } } }This is very basic and there could certainly be some further error checking, logging, and handling done if needed. This will give you a start though.
Joe
- fubarSUSHI
Altocumulus
Wow... thanks. Ill have to check this out and see if it works!
Recent Discussions
Related Content
* 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