Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 

iRule Processing query

teemo_13
Cirrus
Cirrus

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?



1 ACCEPTED SOLUTION

teemo_13
Cirrus
Cirrus

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

View solution in original post

4 REPLIES 4

Hi @teemo_13 , 

If both events are triggered the traffic will be processed by both irules. 
you can use priority in irules to specifiy which irule process traffic first , look at this link to know about priority ( https://clouddocs.f5.com/api/irules/priority.html

you have to plan while writing irules  , it consumes bigip resources. 

_______________________
Regards
Mohamed Kansoh

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?

teemo_13
Cirrus
Cirrus

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 ) 


_______________________
Regards
Mohamed Kansoh