Forum Discussion
Kai_Wilke
Feb 01, 2016MVP
Hi Comms-Core,
you can chain as many conditions in a single
[if]
command by using elseif
or else
conditions. The most restictive conditions are evaluated first followed by the least most restictive conditions.
Based on your provided requirements, the
[if]
command would look like this.
when HTTP_REQUEST {
Format the URI tolower to negate the CASE while comparing the requested URIs
set low_uri [string tolower [HTTP::uri]]
Evalute the contition step-by-step. Starting with the most restrictive condition...
if { $low_uri starts_with "/a/b" } then {
HTTP::redirect "http://[HTTP::host]/b"
} elseif { $low_uri starts_with "/a" } then {
HTTP::redirect "http://[HTTP::host]/"
} elseif { $low_uri starts_with "/b" } then {
pool POOL_1.1.1.1_8090
} else {
The else condition will catch everything else (e.g. /*)
pool POOL_2.2.2.2_8090
}
}
Cheers, Kai