Created
September 3, 2013 19:43
-
-
Save fishnix/6428611 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ltm rule select_pool_by_host_and_uri { | |
| when HTTP_REQUEST { | |
| set url [substr [string tolower [HTTP::host]] 0 ":" ][string tolower [HTTP::uri]] | |
| #log local0. "Saved url as $url" | |
| # If we match exactly, get there fast | |
| if { [class match $url equals yale_pool_selector] } { | |
| pool [class match -value -- $url equals yale_pool_selector] | |
| } else { # else loop through the data-group | |
| set cn yale_pool_selector | |
| set id [class startsearch $cn] | |
| while { [class anymore $cn $id] } { | |
| set n [class nextelement $cn $id] | |
| set u [lindex $n 0] | |
| set p [lindex $n 1] | |
| if { ($url starts_with "$u/") }{ | |
| #log local0. "Matched url: $url with element [class nextelement -name $cn $id]" | |
| pool $p | |
| break | |
| } | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment