Forum Discussion
Using iRule to redirect F5 traffic based on Maintenance.
I would like to know how to redirect F5 traffic using a iRule when the main URL site displays an specific keyword on the main web page (example: "Maintenance"). Keep in mind that the pool members will still be passing health checks during this time. I would also like to incorporate into this same iRule a redirect when all pool members are down.
6 Replies
- Vijay_E
Cirrus
- Samir_Jha_52506
Noctilucent
Tried to write iRule based on the question. Let us know if any question.
when HTTP_REQUEST { if { [active_members [LB::server pool]] == 0 } { HTTP::redirect "http://www.google.com" } } when HTTP_REQUEST_DATA { Define a string-type datagroup called dg_blocked containing words to be "Maintenance" if { [matchclass [HTTP::payload] contains dg_blocked] }{ HTTP::respond 302 Location "https://www.google.com" } }For general payload examination, payload collection is limited by memory allocation constraints to a 32MB maximum.
- Jeremy_Brainerd
Nimbostratus
Thanks for the response back jhaas now I have another question. Is there a way in the iRule/datagroup to look look for this keyword "Maintenance" at a specific URL that is different than what the F5 VS is pointing to?
- Samir_Jha_52506
Noctilucent
Can't grep maintenance keywords from different vip's URL.
- Jeremy_Brainerd
Nimbostratus
jhaas so I wouldn't be able to do the following?
Current F5 Pool routes to abc.com:1009
I would like to check location 123.com for keyword "Maintenance" and once this site contains this keyword I would like to redirect F5 traffic to xzy.com:1009/Maintenance.htm?
If I understand this correctly the keyword "Maintenance" would need to reside on site abc.com:1009 in order to perform the redirect....is this a correct assumption?
- Jeremy_Brainerd
Nimbostratus
Updated to prior question:
Here's the new scenario I would like to know if there's a way to perform the following?
I have a F5 VS with (2) pool members that is routing to http://abc.home.com and would like to know if there is a way to create a irule to check the contents of the following site
http://abc.home.com/home/a/b/Offline.html
and if keyword "Offline" is detected on this site to redirect traffic to http://www.google.com
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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