Forum Discussion
koen_51858
May 05, 2010Nimbostratus
undefined procedure: else
Hi all.
Trying to create an irule that will allow only users from specific countries to access a specific webpage. Any other webpage from that pool however is free for the entire world to access.
With no experience whatsoever with irules or big-ip's I managed (with the excellent help of devcentral) to create a rule that would match my purpose. I'm however stuck at the very last detail. Even after checking the TCL references (http://www.tcl.tk/man/tcl8.4/TclCmd/if.htm) for the syntax and double checking brackets using notepad++ I cannot figure out what is wrong with my irule. Namely the"else" part of my if-function doesn't seem to be allowed.
When I try applying my irules to my big-ip 10.1.0 Virtual Edition I get the following error
I get the following error while applying it to the big-ip 10.1.0 Virtual Edition though: "01070151:3: Rule [test_rule] error: line 21: [undefined procedure: else] [else { comment not even correct page so direct pool access pool www.pool.be } ] "
Iis something you guys can help with? What is wrong with that else-statement at the end of my irule? Any assistance would be appreciated.
allow only belgium and czech repulic access to specific page, rest of pool is free for all
when HTTP_REQUEST {
if {
[HTTP::uri] equals "/test/test/test.aspx"
} then {
switch [whereis [IP::client_addr] country] {
BE {
comment BE
pool www.pool.be
}
CZ {
comment CZ
pool www.pool.be
}
default {
HTTP::redirect "http://www.test.be/no_auth.html"
log local0. "Access to [HTTP::uri] was attempted by [IP::client_addr] from [whereis [IP::client_addr] country]"
}
}
}
else {
comment not even correct page so direct pool access
pool www.pool.be
}
}
end iRule
- koen_51858NimbostratusManaged to find my own error. Solution here for reference.
- e_candelas_2043Historic F5 Account
I can't believe it, a so simple solution, but I guess it shouldn't be like that it should parse the syntax with out taking much attention whether is in a new line or not.
- adam88Cirrus
This was incredibly helpful koen, thank you very much for the solution.
I'm going to have to remove a whole lot of new lines from my codes now XD
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