LTM Maintenance Page Lite
Problem this snippet solves:
Use the LTM as a webserver as a lite version of a maintenance page. In this case, it returns a maintenance page with text to return when the pool members are not available. Also refreshes the client's browser, every x seconds, returning back to the site, in case the site returns to normal after an outage or maintenance.
Contribution
The Bhattman, working off Spark's LTM Maintenance Page which is also based off several other contributors including citizen_elah
Code :
when HTTP_REQUEST { # sets the timer to return client to host URL set stime 10 # Use the Host header value for the responses if it's set. If not, use the VIP address. if {[string length [HTTP::host]]}{ set host [HTTP::host] } else { set host [IP::local_addr] } # Check if the URI is /maintenance switch [HTTP::uri] { "/maintenance" { # Send an HTTP 200 response with a Javascript meta-refresh pointing to the host using a refresh time HTTP::respond 200 content \ "Maintenance page \Sorry! This site is down for maintenance.
" "Content-Type" "text/html" return } } # If the pool_testLB is down, redirect to the maintenance page if { [active_members pool_testLB] < 1 } { HTTP::redirect "http://$host/maintenance" return } }
Published Mar 18, 2015
Version 1.0