If 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