Forum Discussion
lisiecki_54902
Nimbostratus
Jul 01, 2017switch 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] {...
Hannes_Rapp
Nimbostratus
Jul 01, 2017The - (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
}
}
Hannes_Rapp
Nimbostratus
Jul 01, 2017"Will the dash work as an or operator when evaluating hosts?"
Yes it will work
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
