Forum Discussion
Maintenance Page iRule
Dear Team,
We have one virtual server which consists of two pool members on it.
We would like to deploy the maintenance page on F5 if both the pool members are down.
We have an HTML page(which consists of the extension "maintenance.html") with us.
Could you pls let me know the iRule if we want to deploy the above "maintence.html" page on F5?
- muzammil_88686Nimbostratus
Dear Team,
Also note that whenever the user want to access the www.test.com and all the subsequent requests i.e "/*" need to be redirected to maintenance page.
Thank you!
- nitassEmployeewhat version are you running? have you tried sample irule in LTM Maintenance Page below? isn't it usable?
- muzammil_88686NimbostratusThank you for your response!
- What_Lies_Bene1Cirrostratus
The suggested sample is detailed at the URL Nitass has already posted.
- muzammil_88686NimbostratusThank you Steve for your response!
- Chris_MillerAltostratusIf you plan on going to v11 anytime soon, iFiles makes this much easier.
- muzammil_88686NimbostratusThank you Chris for your response and suggestion.
- nitassEmployeesince your maintenance page is simple (no image inside), you may try something like this.
[root@ve10:Active] config b virtual bar80 list virtual bar80 { snat automap pool foo destination 172.28.19.252:80 ip protocol 6 rules myrule profiles { http {} tcp {} } } [root@ve10:Active] config b rule myrule list rule myrule { when RULE_INIT { set static::maint_page "Sorry! This site is down for maintenance." } when HTTP_REQUEST { set maint_prefix "/maintenance.html" if { [HTTP::uri] equals "$maint_prefix" } { HTTP::respond 200 content $static::maint_page "Content-Type" "text/html" "Connection" "Close" return } if { [active_members [LB::server pool]] < 1 } { HTTP::redirect $maint_prefix } } } pool is down [root@ve10:Active] config b pool foo|grep -i pool\ member +-> POOL MEMBER foo/200.200.200.101:80 inactive,down bigip responds maintenance page instead [root@ve10:Active] config curl -iL http://172.28.19.252 HTTP/1.0 302 Found Location: /maintenance.html Server: BigIP Connection: Keep-Alive Content-Length: 0 HTTP/1.0 200 OK Content-Type: text/html Server: BigIP Connection: close Content-Length: 80 Sorry! This site is down for maintenance.
- muzammil_88686NimbostratusThank you Nitass for your response!
- nitassEmployeeUsers will not access any "/maintenance.html" page. If the user is trying to access "www.test.com" i.e "/*"(I mean www.test.com/abc, www.test.com/def, www.test.com/*...etc) it should show the below html pagethe redirection is done by the following part.
if { [active_members [LB::server pool]] < 1 } { HTTP::redirect $maint_prefix }
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