Forum Discussion
Displaying maintenance page from the F5 using ifile and irule
Hi All, I am trying to display maintenance page using iFile and iRule but it is not working. I am currently on version 11.5.3 HF1. I created an HTML maintenance page and import it via File Management and added to iFiles. Whenever I try to hit the VIP from browser, maintenance page does not come up. I am using following iRule:
when HTTP_REQUEST {
if { [active_members [LB::server pool]] == 0 }{
HTTP::respond 200 content "[ifile get my_maintenance_File]" noserver Cache-Control no-cache Connection Close
}
}
- wlopezCirrocumulus
I've done something similar using the LB_FAILED event to get the same results. In this example there are three iFiles (CSS, PNG, HTML). You can use an iRule like this one:
when LB_FAILED { switch [HTTP::path] { "/css/Unavailable.css" { HTTP::respond 200 content [ifile get "Maintenance-css"] "Content-Type" "text/css" return } "/img/MaintenanceLogo.png" { HTTP::respond 200 content [ifile get "Maintenance-png"] "Content-Type" "image/png" return } } HTTP::respond 200 content [ifile get "Maintenance-html"] "Content-Type" "text/html" }
Hope this example helps!
- Simon_BlakelyEmployee
A common gotcha with a Maintenance page is that if the pool members are all down, then the Virtual is marked down, and the connection is rejected before the irule can deliver content.
You need to ensure that the virtual state is disconnected from the pool member state. Or use a fallback host in the http profile to deliver the maintenance message
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