Forum Discussion

Eugene_Reznik_1's avatar
Eugene_Reznik_1
Icon for Nimbostratus rankNimbostratus
Jul 31, 2013

Routing based on URI

I need to create an iRule that would send all traffic to the root of website and and about 100 defined subfolders to the default pool. Any undefined subfolders should go to the market pool.

 

Here is the iRule that I created.

 

when HTTP_REQUEST timing on {

 

set uri [string tolower [HTTP::uri]]

 

switch -glob $uri {

 

"/*/*" {

 

 

switch -glob $uri {

 

 

"/uri1/*" - "/uri2/*" - "/url3/*" - "/uri99/*"

 

{ }

 

default {

 

pool market}

 

}

 

}

 

default {

 

if {!($uri contains ".") && !($uri eq "/")} {

 

pool market} else {

 

pool $default_pool}

 

}

 

}

 

}

 

}

 

 

Here is the problem,

 

test.com/uri1/ goes to the $default_pool

 

test.com/market1/ goes to the market pool

 

but if the url is changed back to test.com/uri1/ the request stays in the market pool but it should have gone to the $default_pool instead.

 

 

Oneconnect profile resolves the issue with routing but it breaks some other functionality with the application itself so we would rather not use it.

 

What am I missing from the iRule to make sure that the request goes to the proper pool?

 

Also, what can I do to optimize the iRule performance? Currently it's averaging about .065ms per request. Do I need to worry about optimizing or is this a decent performance for this iRule?

 

 

Thanks!

 

13 Replies