more than one pool in an iRule

How can I have requests to be evenly distributed across 2 (or more) pools under the same “if” condition in an iRule? For example, If I configure an iRule like:

when HTTP_REQUEST {

if { [HTTP::uri] contains “XXXX” } {

pool pool_1

pool pool_2

}

}

all the requests are going to pool_2 only. I have 2 pools because they run two different services (i.e., pool_1 serves a port different from the one served by pool_2)

Thanks in advance.

All requests are going to pool 2 because the pool command does not cause the iRule to stop executing code. The second pool command is executed immediately after and the pool is changed from pool 1 to pool 2.

You actually don’t need two pools. A pool can consist of members that are listening on a variety of different ports.

-Brian