Forum Discussion
Chris_Miller
Jan 17, 2011Altostratus
Here's what I came up with.
1. I got rid of the "URI::path" and justed used "HTTP::path." Any reason you were using both?
2. I'm assuming your "| |" meant "or." I'm admittedly a bit rusty on that front. :-P.
3. I referenced "pool3" twice in the "WebSocket" part as I wanted to cover both "if" statements. That might not have been necessary but I would have expected the second if to use the default pool if one wasn't selected.
4. Rather than both checking to see whether the header existed and checking to see what it contained, I simply checked whether the header contained the "WebSocket" value. If the header didn't exist, it obviously wouldn't contain said value so I assumed I could do away with that check.
5. You can't really "if" a switch statement which is why you were running into problems.
Give this a shot and let me know what you see.
when HTTP_REQUEST {
if { [string tolower [HTTP::path]] starts_with "/xyz/" or [string tolower [HTTP::query]] contains "xy=9" } {
if { [HTTP::method] eq "GET" and [HTTP::header "Upgrade"] contains "WebSocket" } {
HTTP::disable
pool pool3 }
pool pool3
} else {
switch -glob [string tolower [HTTP::uri]] {
"/fr/app*" { pool pool2 }
default { pool pool1 }
}
}
}