Forum Discussion
muzammil_88686
Jan 05, 2013Nimbostratus
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 pa...
nitass
Jan 09, 2013Employee
since 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.
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