Forum Discussion
annielee_13548
May 13, 2015Nimbostratus
irules optimization
Hi,
I am trying to optimize the irules below (to a for each loop, if possible) im modifying and need some programming help 🙂
if { ([HTTP::host] contains "env-1") || ([HTTP::host] contains "1.1....
- May 13, 2015
can you try something like this?
when HTTP_REQUEST { switch -glob [HTTP::host] { "*env-1" - "1.1.1.1*" { Do something } "*env-2*" - "1.1.1.2*" { Do something } default { Do something } } }
nitass
Employee
can i ask can the below exist ? multiple switch -glob
if you mean something like this, yes.
when HTTP_REQUEST {
switch -glob [HTTP::host] {
"*env-1*" -
"1.1.1.1*" {
Do something
}
"*env-2*" -
"1.1.1.2*" {
Do something
}
default {
switch -glob [string tolower [HTTP::uri]] {
"*aaa*" {
Do something
}
default {
Do something
}
}
}
}
}
annielee_13548
May 14, 2015Nimbostratus
not really.. coz in the existing irules now, there are a lot of IFs and some ifs are comparing the URI (with equals, ends with, contains), some comparing variables, some comparing headers. I would like to modify the rules to be 'better', hence you recommended the switch -glob
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