Forum Discussion
JCMATTOS_41723
Nimbostratus
Aug 08, 2013Combining Swtich iRules for HTTP::uri and HTTP::cookie?
We have version 11.1 and trying to create a new application workflow process by combining the current switch irules into one. We currently have an HTTP::uri and HTTP::cookie irules working separately...
Kevin_Stewart
Employee
Aug 08, 2013If I understand what you're doing, it looks like you're attempting to use a switch command as a condition to a higher switch command, which wouldn't work. You can nest switches if you put the internal conditionals INSIDE the action of a specific condition:
Example:
switch test1 {
"test1_condition1" {
switch test2 {
test2_condition1 {...}
}
}
}
So if you're trying to say "if a URI equals something -OR- a cookie equals something, then I think you really need to first pick the most important one and refactor them:
Example:
when HTTP_REQUEST {
switch - glob [string tolower [HTTP::uri]] {
"*/application/*" {
pool QA-POOLA-80
}
default {
switch -glob [HTTP::cookie "UserInfo"] {
"*COMPANYID=GC*" {
pool QA-POOLB-80
}
}
}
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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