Forum Discussion
Michael_Yates
Nimbostratus
Nov 07, 2011Hi greenfroguk,
Anything after the "?" is part of the [HTTP::query], so you can use that as the qualifier for your logic first.
Then you can analyze the [HTTP::uri] to see if it starts with your second condition.
I agree with Arie, that a switch statement would be more efficient than nested if / elseif statements and would make it much easier to scale if you ever need to add sub-directories.
when HTTP_REQUEST {
if { [string tolower [HTTP::query]] contains "e02extport.com" } {
switch -glob [string tolower [HTTP::uri]] {
"/var1*" { pool pool_ext_e02_var1 }
"/var2*" { pool pool_ext_e02_var2 }
"/var3*" { pool pool_ext_e02_var3 }
"/var4*" { pool pool_ext_e02_var4 }
}
}
else {
pool pool_ext_e02_default
}
}
Hope this helps.