Can you use nested events in iRules?
For example:
when SERVER_CONNECTED { set portInbound [string tolower [TCP::local_port]]
if { $portInbound = 9999} { blah }
when HTTP_REQUEST {
if { $portInbound = 111} {
blah blah
}
}
}
No you cannot, but further, these events operate in different contexts (client side vs. server side). A few considerations though:
-
You don’t need [string tolower ] with a command that returns a number.
-
You’re using the [TCP::local_port] command in the SERVER_CONNECTED event, but I’m assuming you mean the incoming listening port. If that’s the case, this value would be available from the HTTP_REQUEST event.