Forum Discussion
switch on multiple domains
The - (dash) is your logical OR in switch-condition. Unlike in if-condition, you cannot use or as a word. If I get it right, you're trying to improve readability of this code? Would merging the two parts into one help?
switch -glob [string tolower [HTTP::host][HTTP::path]] {
"www.foo.com/foo*" -
"www.foobar.com/foo*" {
do something
}
}
- lisiecki_54902Jul 01, 2017
Nimbostratus
Hello Hannes, Thank-you for your reply. Unfortunately no to the merge. I have multiple domains but domain-A and domain-B both share all the same uri entries ( which I will switch for different pools). In the top level switch I need to match domain-A or domain-B, then I need to add different logic for domain-c, domain-d etc. Will the dash work as an or operator when evaluating hosts?
- Hannes_RappJul 01, 2017
Nimbostratus
"Will the dash work as an or operator when evaluating hosts?"
Yes it will work
Recent Discussions
Related Content
* 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
