Forum Discussion

Jeremy_Brainerd's avatar
Jeremy_Brainerd
Icon for Nimbostratus rankNimbostratus
Mar 31, 2017

iRule to redirect F5 traffic based on keyword content.

I am trying to figure out a way to redirect F5 traffic.

 

Here's my scenario: Normal traffic is routing to http://abc.example.com/home/A/B/Login.html

 

I need something where during a Maintenance window traffic gets diverted from the normal traffic pattern.

 

I need to monitor the following website contents http://abc.example.com/home/A/B/Offline.html and the only contents on this web page will be either "Online" or "Offline" if the contents contain "Online" following normal traffic pattern but if the contents contain "Offline" I need the traffic redirected to something.home.com:9001/Maintenance.htm.

 

Is this possible or is there a better way to accomplish this task? Thanks and appreciate any assistance.

 

2 Replies

  • Can you use a redirect when the pool members are down during maintenance ? You can probably use a monitor that checks the application hosted by the pool members:

    when HTTP_REQUEST {
    if { [LB::server pool] < 1 } {
    HTTP::respond 301 Location "http://abc.example.com/home/A/B/Offline.html"
    }
    }
    
  • First, you'll need to associate an http monitor to your pool, the monitor should check the uri /A/B/Offline.html and search for the Receive String "Online"

     

    Then, if the user should be redireted to something.home.com:9001/Maintenance.htm, you can create and associate a http profile to your VS, in the profile you have a setting called "Fallback Host", if no member is up for that VS, then the fallback is sent to the client as the location of a 302 redirect.