James_Ramsey_10
May 31, 2007Nimbostratus
maintenance
I would like to setup an rule to send all traffic to http://maintenance.mysite.com from a virtual server when all 6 pools are down. Could anyone help me out?
Thanks
Thanks
when HTTP_REQUEST {
if { 0 == [active_members [LB::server pool]] } {
HTTP::redirect "http://backup_domain/maintenance.html"
}
}
Then, just disable all members in the pool and the active_members count will go to zero and the redirect will occur.
Keep in mind, that you could also embed a HTML page directly in the iRule and return that with a HTTP::respond. See the "Custom Reporting with iRules" tech tip I wrote a while back...
http://devcentral.f5.com/Default.aspx?tabid=63&articleType=ArticleView&articleId=66
Click hereThe only gotcha is that you can't store any images on the BIG-IP, the response will have to be the entire content.
-Joe
Example:
I want to send *.mysite.com to maintenance.mysite.com and want to send *.mysitealso.com to maintenance.mysitealso.com
http://devcentral.f5.com/wiki/default.aspx/iRules/domain.html
Click hereGive this a shot...
when HTTP_REQUEST {
if { 0 == [active_members [LB::server pool]] } {
set dom [domain [HTTP::host] 2]
HTTP::redirect "http://maintenance.${dom}"
}
}
Or, without the local variable
when HTTP_REQUEST {
if { 0 == [active_members [LB::server pool]] } {
HTTP::redirect "http://maintenance.[domain [HTTP::host] 2]"
}
}
-Joe