I would like to know how to setup an IRule which will redirect all the HTTP/HTTPS traffic to URL(say under_maintenance.htm) when we make websites down for maintenance activities.
Also, in case of case of NLB with 2 NODES. where both nodes are down then how to redirect the traffic to a custom page.
Fallback Host: Inside the HTTP profile is an option called Fallback Host. This option, when defined, will send a 302 redirect to the specified address if all pool members are down. No iRules needed.
active_members check: a simple active_members check of the pool and then whatever you need to happen if all members are down:
when CLIENT_ACCEPTED {
set default_pool [LB::server pool]
}
when HTTP_REQUEST {
if { [active_members $default_pool] < 1 } {
send a redirect or output HTML content here
}
}
Since the Fallback Host generates a 302 (possibly followed by a 200) this could do bad things to SEO. A 503 (Service Unavailable) would be preferable in many cases.