Forum Discussion
greenfroguk_338
Nov 07, 2011Nimbostratus
Basic iRule to redirect to pools
Hi,
We have a VIP created and against that VIP have a very basic iRule.
The idea is that depending on two matches on the URI it directs to a different pool. I know there will be a ...
Michael_Yates
Nov 07, 2011Nimbostratus
Hi 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.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects