Forum Discussion

8 Replies

  • A 301 redirect would help achieve this. You can try below i-rule to your VIP.

     

    when HTTP_REQUEST { switch [string tolower [HTTP::host]] { /offline/*" { HTTP::respond 301 Location "; }}}

     

  • Maneesh thanks for your suggestion. Now will this work even if the pool members are still active and passing Health checks?

     

    I also want to provide clarification that this keyword resides within the following URL site http://abc.home.com/home/a/b/Offline.html

     

    So when the above site is accessed it will display Online for normal traffic flow or Offline which then requires me to redirect the traffic over to URL http://www.example.com:1010/Maintenance.htm

     

  • requests are being made for "; but you want to check the page ";, so [HTTP::host] will not cover what you want to check for. That is ONLY checking the host portion of the URL, and from your question you don't want to check that either, you want to check the content of the page ";

    1- set a health check for your pool members to do a GET and look for "Offline" in the page.

    2- use an iRule to determine the health of a pool and then re direct otherwise:

    when CLIENT_ACCEPTED { set DEFAULT_POOL [LB::server pool] }

    when HTTP_REQUEST {

    if {[active_members $DEFAULT_POOL] == 0} {
    
        HTTP::respond 301 Location "http://www.google.com"
    
    } else {
    
        pool $DEFAULT_POOL
    }
    

    }

    • Jeremy_Brainerd's avatar
      Jeremy_Brainerd
      Icon for Nimbostratus rankNimbostratus

      Soda Cup - I'm pretty new to iRules so I don't understand the Health check on how if that check fails I can redirect?

       

    • Soda_Cup_148395's avatar
      Soda_Cup_148395
      Icon for Nimbostratus rankNimbostratus

      the layer 7 health check will determine if content is available on a page or if the server is available at all. Your health checks for your pool can be completely different than what they members deliver to the users.

       

      for your http health check send this- http://abc.home.com/home/a/b/Offline.html

       

      leave the return string blank(any response passes) or look for a string that exists on the page like "Offline". For troubleshooting purposes I would just leave it blank

       

      Then the f5 will monitor the members. For each connection to the VS the iRule will check if the number of available servers. If it is 0, then a redirect is send back to the client. If at least one pool member is available, it will balance to the default pool.

       

      If you want to test create a test pool with the same members and a test VIP with the iRule.

       

    • Jeremy_Brainerd's avatar
      Jeremy_Brainerd
      Icon for Nimbostratus rankNimbostratus

      Soda Cup thanks for the response back and your response is clear now. However I am still struggling with the following Health Monitor as I need to check the status of the site for "Online" all is good continue to route traffic normal but when I see "Offline" I need to redirect traffic to a "Maintenance" page, I also have a HTTP Profile configured with a failback host to redirect traffic to a "Unavailable" page when all pool members are down. Here's what I have configured for the Health Monitor but it just doesn't seem to work.

       

      Send String: GET /home/a/b/Offline.html\r\n\r\n

       

      Receive String: Online

       

      Receive Disable String: Offline

       

      Any assistance in getting something put together to get me working results would be greatly appreciated.