Forum Discussion
Chris_Miller
Altostratus
Jun 11, 2010Most efficient way to do if, else?
Good morning all,
This snippet is part of an http_response event. The rule compares the IP of the server responding to datagroups to see which pool the server is in. Based on that, the rule sets a co...
Chris_Miller
Altostratus
Jun 11, 2010Posted By hoolio on 06/11/2010 05:46 AM
Hi Chris,
Which version are you running? If you're on pre-10.10 I think you'd need to continue with the if/elseif/.../else chain you have above. switch will only allow you to check one string against a list of cases.
If you're on 10.1.0 or higher you can use a new "value" option in an address type datagroup to store the strPodNumber as that value. You could then combine all of the IP addresses/ranges into a single datagroup and then use the class command to search that datagroup. See this post for details:
http://devcentral.f5.com/Default.aspx?tabid=53&view=topic&postid=1167195&ptarget=1167195
Aaron
I'm running 10.2. I'll check that link and reply if I have another question about how to use it. Thanks!
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
