Hi SMP,
You can use the -glob flag for wildcard handling with the switch statement. Here are some examples:
when HTTP_REQUEST {
switch -glob [HTTP::uri] {
"/" {
Exact match for /
HTTP::redirect "https://www.myapp.com/somewhere_else"
}
"/custom*" {
URI starts with /custom
HTTP::redirect "http://www.myapp.com/custom"
}
"*gif" -
"*jpg" -
"*css" -
All these cases use the same action.
URI ends with a static file type
pool static_http_pool
}
"/app[0-9]*" {
URI starts with /app where is a digit
HTTP::redirect "https://www.myapp.com/app"
}
"/app?" {
URI starts with /app? where ? is any single character
as /app[0-9]* is before this, ? would be any non-digit character
HTTP::redirect "https://www.myapp.com/app2"
}
default {
No prior match so take some default action
HTTP::redirect "http://www.myapp.com/default"
}
}
}
The glob style matching is the same as with string match. So you can check the string and switch man pages for details:
http://www.tcl.tk/man/tcl8.4/TclCmd/switch.htm
http://www.tcl.tk/man/tcl8.4/TclCmd/string.htm
Aaron