Forum Discussion

teemo_13's avatar
teemo_13
Icon for Cirrus rankCirrus
Aug 26, 2023

iRule Processing query

I have a question.

If for example I have 2 events in an iRule

when CLIENT_ACCEPTED {

           if { [Condition]}{ do something}
    }

}

when HTTP_REQUEST{

           if { [Condition]}{ do something}
    }

}

If both the conditions are met on both events, will the iRule process the traffic twice? once for the first event then one for the 2nd event?



  • Nevermind, I've run this on my Lab. The answer is server 3 for all  those who would look for the answers

    • teemo_13's avatar
      teemo_13
      Icon for Cirrus rankCirrus

      HI Mohamed_Ahmed_Kansoh ,

      If I would not use priority, would the "if" statement in the "when HTTP_REQUEST" block after the "if" statement in the "when CLIENT_ACCEPTED" has happened?

      For example if I have a client 1.1.1.1 going to accessing server3.example.com:

      when CLIENT_ACCEPTED {
      if { [IP::addr [IP:: client_addr] equals 1.1.1.1 ] } { pool server1
      }
      if ( [IP::addr [IP:: client_addr] equals 1.1.1.2 ] } { pool server2
      }
      }
      when HTTP_REQUEST {
      if
      }
      HTTP::host equals "server3.example.com" } pool server3
      if {HTTP::host equals "server4.example.com" }
      pool server4
      }
      }

      Will this go to server1 pool or the server3 prool?

  • Nevermind, I've run this on my Lab. The answer is server 3 for all  those who would look for the answers

    • yes , That's correct 
      It will trigger the first event , then the second event 
      and take the last Action has been done. 

      to make sure of this also ( use log command in irule to show you a log message in ltm log after each action , this will make you know which event triggered also which condition has been met and which action has been performed )