F5 is upgrading its customer support chat feature on My.F5.com. Chat support will be unavailable from 6am-10am PST on 1/20/26. Refer to K000159584 for details.

Forum Discussion

asamosaad's avatar
asamosaad
Icon for Nimbostratus rankNimbostratus
Mar 04, 2020

iRule to redirect to another VIP if all pool members are down

Hi! as a newbie i need to get get help for an iRule to check if all pool members are down then forward http requests for domains abc.com & xyz* to another vServer (VIP).

I would be thankful for your help

4 Replies

  • Please try this ,

     

    when HTTP_REQUEST { if { [active_members EXAMPLETEST_POOL] == 0 } { HTTP::redirect "https://abc.com" } }

     

    Hope it helps you!

     

    Mayur

    • asamosaad's avatar
      asamosaad
      Icon for Nimbostratus rankNimbostratus

      Hi Mayur,

      Thank you for your answer, i do appreciate it.

      there are two conditions for the redirect:

      • all pool member is down?
        • is domain abc.com OR xyz.*?
        • then redirect to another vServer VS2 on the same ltm
  • I tried to manipulate it. Please check if it works for you.

     

    when HTTP_REQUEST {

         

    if { [HTTP::host] equals "abc.com" and { if { [active_members abc_POOL] == 0 } 

    }} {

    HTTP::redirect "https://redirect.com"

    }

    if { [HTTP::host] equals "xyz.com" and { if { [active_members xyz_POOL] == 0 } 

    }} {

    HTTP::redirect "https://redirect.com"

    }

    }

    • asamosaad's avatar
      asamosaad
      Icon for Nimbostratus rankNimbostratus

      I will diffidently try it and will let you know if it works.

      I have also made this one using the of google, what do you think about it?

       

      when HTTP_REQUEST {

      if {[active_members [LB::server pool]] == 0 } {

      if {(([string tolower [HTTP::host]] equals "abc.com") || 

      ([string tolower [HTTP::host]] equals "xyz.com") ||

      ([string tolower [HTTP::host]] contains "example"))

      HTTP::redirect "https://redirect.com"

      }

      }

      }