Forum Discussion
rajeshgoud
Altostratus
Mar 09, 2016maintenance page for VIP with different hosts point to different pools if available else redirect to http://$host/maintenance
when HTTP_REQUEST {
sets the timer to return client to host URL set stime 10
Check if the URI is /maintenance switch [HTTP::uri] {
"/maintenance" {
Send an HTTP 200 response with...
Stanislas_Piro2
Cumulonimbus
Mar 09, 2016Another point to simplify the configuration. use relative links in redirect instead of absolute if it is on the same Web service...
Replace :
HTTP::redirect "http://$host/maintenance"
By :
HTTP::redirect "/maintenance"
And with the auto refresh in the javascript, redirect to the previous URL for a better user experience..
when HTTP_REQUEST {
Check if the URI is /maintenance
switch [HTTP::uri] {
"/maintenance" {
sets the timer to return client to host URL
set stime 10
Send an HTTP 200 response with a Javascript meta-refresh pointing to the host using a refresh time
HTTP::respond 200 content \
" \
Sorry! This site is down for maintenance." "Content-Type" "text/html"
return
}
}
If the respective pool is down, redirect to the maintenance page else
send the request to the respective pool
if { [ string length [HTTP::host] eq test.com ] && [ active_members test_PROD_V ] < 1 } {
log local0. $host
HTTP::redirect "http://$host/maintenance?uri=[HTTP::uri]"
return
} else {
pool test_PROD_V
}
}
The following irule is one configured for some customers:
when HTTP_REQUEST {
switch [HTTP::path] {
"/maintenance/logo.png" {
HTTP::respond 200 content [ifile get "logo.png"] "Content-Type" "image/png"
return
}
"/maintenance/maintenance.html" {
HTTP::respond 200 content [ifile get "maintenance.html"] "Content-Type" "text/html"
return
}
"/maintenance/error.html" {
HTTP::respond 200 content [ifile get "error.html"] "Content-Type" "text/html"
return
}
default {
set dpool [LB::server pool]
if { $dpool equals "" } { HTTP::redirect "/maintenance/error.html" ; unset dpool; return}
if { [active_members $dpool] == 0 } { HTTP::redirect "/maintenance/maintenance.html"; unset dpool; return}
unset dpool
}
}
}
when HTTP_RESPONSE {
if { [HTTP::status] eq "404" } { HTTP::redirect "/maintenance/error.html" }
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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