Forum Discussion
Colin_Walker_12
Jan 05, 2011Historic F5 Account
Okay, to answer some of the questions:
If you don't want traffic going to a default pool, just make sure the default action in your logic case (switch, if/else, whatever) is to drop, and you'll never get things sent to the default pool. The only time the default pool is used is when there is no explicit balancing decision made within the iRule.
Yes, switch matches from the top down.
Yes, there is a better way, assuming you are going to end up with LOTS of matches. If you put these into a class you can write the logic once, and expand the class as needed with new URI/pool pairs without ever modifying the code.
It'd look something like this:
when HTTP_REQUEST {
set myPool ""
set myPool [class search -value myClass starts_with [string tolower [HTTP::path]]]
if {$myPool ne ""}
pool $myPool
} else {
drop
}
}
With a class that looks like:
class myClass {
"/apps/applytojoin" := "lpl_site1_https_applytojoin"
"/apps/applytonotjoin" := "lpl_site1_https_applytonotjoin"
...
etc.
This way as you get new path/pool combos, you just add them to the class and the logic stays the same. Make sense?
Colin