Forum Discussion
switch on multiple domains
I have multiple domains and want to match behavior for URI, can I use an or for the host?
switch [string tolower[HTTP::host]]
{
"www.foo.com" -
"www.foobar.com" {
switch -glob [HTTP::uri] {
"/foo*" {
do something
}
}
}
}
3 Replies
- Hannes_Rapp
Nimbostratus
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_54902
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_Rapp
Nimbostratus
"Will the dash work as an or operator when evaluating hosts?"
Yes it will work
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
