Forum Discussion

Amit787's avatar
Amit787
Icon for Nimbostratus rankNimbostratus
Oct 06, 2020

Need to forward traffic on specific pool according to uri over 500 urls

Hello

I am having requirement to setup new url "example.com" and when user try to access

"example.com/user1" traffic should be on "pool1"

"example.com/user2" traffic should be on "pool2"

"example.com/user3" traffic should be on "pool3"

.

.

"example.com/user500" traffic should be on "pool500"

 

Need dynamic way to achieve this, instead of writing 500 lines of code.

 

Please advice.

Thanks,

Amit

3 Replies

  • Hi Amit,

    Can you try this iRule?

    when HTTP_REQUEST {
    	if { [HTTP::host] equals "example.com" && [HTTP::uri] matches_regex {\/user[0-9]{1,3}} } {
    		set poolID [string trimleft [HTTP::uri] "/user"]
    		set poolname "pool$poolID"
    		# log local0. "poolname: $poolname"
    		pool $poolname
    	}
    }
  • Thanks you sooo much "eaa". Solution worked.... :)

  • And thanks a lot for your quick support as well... ​