Forum Discussion
Brian_69413
Jun 14, 2012Nimbostratus
Default pool in a switch statement
We have a Virtual Server that is assigned a default pool and also an iRule that applies a different pool given a certain path. We believe this was working fine as an if statement, but was recently ch...
hooleylist
Jun 14, 2012Cirrostratus
Hi Brian,
Did you have an else clause in the if statement? If so, you were assigning a pool in all cases in the iRule. If you didn't have an else clause, I'd guess it was just coincidence that you noticed the issue after changing to a switch statement.
I think it's most intuitive if you use an iRule to assign a pool in some cases to do it in all cases. If you want to reference the VS default pool, you can save the name in CLIENT_ACCEPTED:
when CLIENT_ACCEPTED {
set default_pool [LB::server pool]
}
when HTTP_REQUEST {
switch -glob [HTTP::path] {
"/app1*" {
pool pool_app1
}
"/app2*" {
pool pool_app2
}
default {
pool $default_pool
}
}
}
Or if you want to avoid specifying the pool in each iRule condition, you could add a OneConnect profile to the virtual server. If you're using SNAT, you can use the default OneConnect profile with a /0 source mask. Else, create a custom /32 source mask OneConnect profile and add that to the virtual server.
Aaron
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