Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Amit787
Nimbostratus
Nimbostratus

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 3

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
	}
}

Amit787
Nimbostratus
Nimbostratus

Thanks you sooo much "eaa". Solution worked.... 🙂

Amit787
Nimbostratus
Nimbostratus

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