Forum Discussion
Brent_West_7733
Sep 19, 2014Historic F5 Account
Maybe something like this would help?
when HTTP_REQUEST {
set debug 1
set client_info "[IP::client_addr]:[TCP::remote_port]: [HTTP::host][HTTP::uri]"
if { $debug } {
log local0. "$client_info requests [HTTP::host] and [HTTP::uri]"
}
if { [string tolower [HTTP::uri]] starts_with "/login" } {
if { $debug } { log local0. "$client_info - line 9 selected - pool is Pool_Admin_64" }
pool Pool_Admin_64
}
elseif { [string tolower [HTTP::uri]] starts_with "/lz/" } {
if { $debug } { log local0. "$client_info - line 14 selected - pool is Pool_Landing_64" }
pool Pool_Landing_64
}
elseif { [getfield [string tolower [HTTP::host]] ":" 1] eq "www.communigator.co.uk"} {
if { $debug } { log local0. "$client_info - line 19 selected - pool is Pool_Website" }
pool Pool_Website
}
else {
if { $debug } { log local0. "$client_info - line 24 selected - No Match, using default" }
}}
- Brent_West_7733Sep 19, 2014Historic F5 AccountThe [HTTP::host] can look like www.example.com:80 which is why we need the getfield, and we would like our test to be case insensitive, hence the string tolower. The [HTTP::uri] should be case insensitive, and I removed your wildcard, because string matches don't work that way. starts_with is sufficient. I added 'elseif' because you usually want the iRule to stop processing conditionals after a pool selection is made, but in cases where there are multiple possible matches (a host and a uri) plan your logic accordingly. The last 'pool' statement wins. After you get your iRule situated, remove the debugging statements unless you want them