Forum Discussion
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
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.- teemo_13Cirrus
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_13Cirrus
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 )
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com