Forum Discussion
James_Ramsey_10
Nimbostratus
May 31, 2007maintenance
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
5 Replies
- JRahm
Admin
Would the fallback host option in the http profile not work for you? - James_Ramsey_10
Nimbostratus
Not sure, how would that work? Here is an example. We do maintenace one very few weeks. I have 6 pools. I would like to force fail the pools, and then send all the requests to another URL. Once we are done with maintenance, I would like to un-fail, and allow traffic back to the 6 pools. - You can always get the number of active members in the current pool with the active_members command. Something like this should work for you...
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 here
The only gotcha is that you can't store any images on the BIG-IP, the response will have to be the entire content.
-Joe - James_Ramsey_10
Nimbostratus
This works great, but I just need one more question answered. I have around 500 pools, how do i set a redirect based off the domain. I don't really want to create 1 rule for each pool.
Example:
I want to send *.mysite.com to maintenance.mysite.com and want to send *.mysitealso.com to maintenance.mysitealso.com - It's your lucky day, I think the domain command is just what you need!
http://devcentral.f5.com/wiki/default.aspx/iRules/domain.html
Click here
Give 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 variablewhen HTTP_REQUEST { if { 0 == [active_members [LB::server pool]] } { HTTP::redirect "http://maintenance.[domain [HTTP::host] 2]" } }
-Joe
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