Forum Discussion

deantotham_2141's avatar
deantotham_2141
Icon for Nimbostratus rankNimbostratus
Jul 04, 2007

two whens?

Is there a way to have two when condition statements in the same iRule.

 

I.e.

 

 

I am happy using this statement for regional IP source redirects

 

 

when CLIENT_ACCEPTED { if { [IP::addr [IP::client_addr]/24 equals 10.223.34.0] } { pool gw-pool member 10.223.32.1 } elseif { [IP::addr [IP::client_addr]/24 equals 10.236.36.0] } { pool gw-pool member 10.223.36.1 } else { Your other conditions, if necessary }}

 

 

But I would love to add a LB_Failed in there too!

 

 

so the logic would be when IP is acknowledged before redirecting to local gw-pool member check if gw-pool member is up if not send elsewhere.

2 Replies

  • You can have as many event handlers (when statements) in your iRule as you wish.

    when HTTP_REQUEST {
       do something
    }
    when HTTP_RESPONSE {
       do something
    }

    In fact, you can have mulitple duplicate events in the same iRule (as long as you specify a different priority for them.)

    when HTTP_REQUEST priority 100 {
       do something
    }
    when HTTP_REQUEST priority 200 {
       do something else
    }

    The default priority for an event handler is 500. Valid values are 0 to 1000 and they are processed from lowest to highest.

    -Joe
  • Thanks Joe, I have subsequently spoken to a F5 engineer and was given a run down of the Topology feature which is what I was looking for which works in conjuntion with Health Checks.