Good Afternoon,
I am struggling to find a winning combination for the following process.
The default Virtual Server pool is different and required for all other sites.
Step 1 - The website www.communigator.co.uk to use Pool_Website
Step 2 - Any website with the /LZ/ in the URi to us Pool_Landing_64
Step 3 - The web site www.communigator.co.uk with URI /login to use Pool_Admnin_64
I can get the site to hit the pool in step 1 but I get mixed response from when I try and add step 2 and 3.
Here is the syntax so far.
when HTTP_REQUEST { if {[HTTP::uri] starts_with “/login”} { pool Pool_Admin_64 }
if {[HTTP::uri] starts_with "/lz/*"} {
pool Pool_Landing_64 }
if { [HTTP::host] eq "www.communigator.co.uk"} {
pool Pool_Website }
}
Regards, Stuart
when HTTP_REQUEST { if { [HTTP::path] starts_with “/lz/" }{ pool Pool_Landing_64 } elseif { [HTTP::path] starts_with "/login/ ” }{ pool Pool_Admin_64 } else { pool Pool_Website } }
El_Jefe
September 19, 2014, 4:32pm
3
when HTTP_REQUEST { if { [HTTP::path] starts_with “/lz/" }{ pool Pool_Landing_64 } elseif { [HTTP::path] starts_with "/login/ ” }{ pool Pool_Admin_64 } else { pool Pool_Website } }
shaggy
September 19, 2014, 4:47pm
4
throw some tolower’s in there, too: … if { [string tolower [HTTP::path]] starts_with “/lz/” }{ pool Pool_Landing_64 } elseif {[string tolower [HTTP::path]] starts_with “/login/” }{ pool Pool_Admin_64 …
shaggy
September 19, 2014, 4:47pm
5
throw some tolower’s in there, too: … if { [string tolower [HTTP::path]] starts_with “/lz/” }{ pool Pool_Landing_64 } elseif {[string tolower [HTTP::path]] starts_with “/login/” }{ pool Pool_Admin_64 …
El_Jefe
September 19, 2014, 5:06pm
6
windowdressing. screen doors on submarines.
windowdressing. screen doors on submarines.
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" }
}}
The [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
Good Morning Brent West,
Thank you for your prompt reply and comments I will review and come back to you shortly.
Regards, Stuart
Thank you Brent, it has provided 99% of my requirement however when it turns out I need to change “/lz/” so I can wildcard anything before for example “*lz/” but that seems to fail any ideas?
Regards, Stuart