rjordan
May 04, 2011Nimbostratus
Stop processing iRule if condition is met?
I have an existing iRule that directs traffic to various pools based on the host name. It was requested that connections from specific source IPs be directed to specific nodes. I added this functionality in the CLIENT_ACCEPTED event in the iRule but the node decision seems to be "overridden" during the HTTP_REQUEST event. Is there a way to stop processing the rule in my IF statement? Or should move the IF statement into the HTTP_REQUEST?
Below is a simplified version of the iRule. Please excuse minor syntax issues, I just wrote it so you can see the basic functionality and flow.
when CLIENT_ACCEPTED {
if { [IP::client_addr] equals 1.2.3.4 } {
node 192.168.10.10 80
}
}
when HTTP_REQUEST {
if { [HTTP::host] contains domain1.com {
pool domain1.com_pool
}
elseif { [HTTP::host] contains domain2.com {
pool domain2.com_pool
}
else {
pool domain.com_pool
}
}