Forum Discussion
derek_mccabe_10
Nimbostratus
Aug 25, 2006if - elseif statement not working
Hi All,
just wondering if you could help a noob out with a simple statement - code is below and i get the following errors:
line 9: [undefined procedure: elseif] [elseif { [HTTP::host] equals "ghi" } {
line 12: [undefined procedure: else] [else {
when HTTP_REQUEST {
if { [HTTP::host] equals "www.abc.co.uk" } {
use pool abc
}
elseif { [HTTP::host] equals "www.def.co.uk" } {
use pool def
}
elseif { [HTTP::host] equals "www.ghi.com" } {
use pool ghi
}
else {
discard
}
}
2 Replies
- derek_mccabe_10
Nimbostratus
please ignore the post guys - didnt realize the positioning of the closing brackets before the elseif was essential - for other noobs that may have similar issues:
when HTTP_REQUEST {
set host [string tolower [HTTP::host]]
if { $host eq "www.abc.co.uk"} {
pool abc
} elseif { $host eq "www.def.co.uk"} {
pool def
} elseif { $host eq "www.ghi-online.com"} {
pool ghi
} else {
discard
}
} - tom_93460
Nimbostratus
I ran into a really dumb way to produce this error....
Put two "else" statements against a single "if"..
Doh!
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