Forum Discussion
Sean_Lagerholm_
Nimbostratus
Jan 24, 2006iRule syntax problems
I keep getting an error that I'm missing a close brace. I'm trying to implement the following irule :
rule myweb_service {
when HTTP_REQUEST {
if {[HTTP::host] eq "mysite1.com"}...
Jan 24, 2006
A couple of points.
1) remove the "rule" enclosure unless you are editing from the configuration file directly.
2) use "elseif" instead of "else if".
when HTTP_REQUEST {
if { [HTTP::host] eq "mysite1.com" } {
pool mysite1.com
} elseif { [HTTP::host] eq "mysite2.com" } {
pool mysite2.com
} elseif { [HTTP::host] eq "mysite3.com" } {
pool mysite3.com
} elseif { [HTTP::host] eq "mysite4.com" } {
pool mysite4.com
} elseif { [HTTP::host] eq "mysite5.com" } {
pool mysite5.com
} elseif { [HTTP::host] eq "mysite6.com" } {
pool mysite6.com
} elseif { [HTTP::host] eq "mysite7.com" } {
pool mysite7.com
} else {
discard
}
}
You could also make this much cleaner by using an external data group (do a search for matchclass/findclass in the forums).
-Joe
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