Forum Discussion
hooleylist
Oct 21, 2009Cirrostratus
Hi Rob,
That looks pretty close. Can you try this version with some debug logging added? I used the -glob flag on switch to group of few of the cases together. The curly braces also needed a tweak.
when HTTP_REQUEST {
log local0. "[IP::client_addr]:[TCP::client_port]: New [HTTP::method] request to [HTTP::host][HTTP::uri]"
if { [IP::addr [IP::client_addr]/32 equals 1.1.1.1] } {
log local0. "[IP::client_addr]:[TCP::client_port]: Matched IP check for 1.1.1.1"
switch -glob [string tolower [HTTP::uri]] {
"/product[1-3]" {
log local0. "[IP::client_addr]:[TCP::client_port]: Matched /product1-3 check"
pool product1-CustomerA
}
default {
log local0. "[IP::client_addr]:[TCP::client_port]: No match on /product1-3 check"
pool standardpool-CustomerA
}
}
} else {
switch -glob [string tolower [HTTP::uri]] {
"/product1" {
log local0. "[IP::client_addr]:[TCP::client_port]: No IP match. Matched /product1 check"
pool product1
}
"/product[2-3]" {
log local0. "[IP::client_addr]:[TCP::client_port]: No IP match. Matched /product2-3 check"
pool product2
}
default {
log local0. "[IP::client_addr]:[TCP::client_port]: No IP match. No product check"
pool standardpool-CustomerB
}
}
}
}
Aaron