Forum Discussion
MK_62657
Nimbostratus
Feb 13, 2008Using F5 as a fall back host
Hello:
Is any using the F5 device itself as a fall back host? I would like to host the maintenance page on the device itself if possible instead of having another server as the fallback host...
hoolio
Cirrostratus
Jul 25, 2008If you're using the GUI or iRuler, here is the rule text you can paste in:
when RULE_INIT {
maint_prefix must not contain a trailing slash
maint_prefix also must not exist on your real web servers
set maint_prefix "/maintenancepage"
set maint_len [string length $maint_prefix]
}
when HTTP_REQUEST {
Service requests for files (URIs) from the maintenance page
Note that we always service these pages, even if the http_pool is up
set uri [HTTP::uri]
if { $uri equals ${::maint_prefix} } {
HTTP::respond 301 "Location" "${::maint_prefix}/"
return
}
if { $uri starts_with "${::maint_prefix}/" } {
trim off the maintenance prefix
set uri [string range $uri $::maint_len end]
Return the requested page
switch $uri {
"/" -
"/index.html" { HTTP::respond 200 content [lindex $::maint_index_html 0] "Content-Type" "text/html" }
"/logo.png" { HTTP::respond 200 content [b64decode [lindex $::maint_logo_png 0]] "Content-Type" "image/png" }
default { HTTP::respond 404 }
}
return
}
If the http_pool is down, redirect to the maintenance page
if { [active_members http_pool] < 1 } {
HTTP::redirect "${::maint_prefix}/index.html"
return
}
}
The classes are defined separately in the GUI under Local Traffic >> iRules >> Datagroup List.
Aaron
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