Forum Discussion
iRule syntax error
Hello
Could you please help me correcting my following iRule?
I am newbie to iRules, so I couldn't figure out the error.
when HTTP_REQUEST {
switch -exact -- [HTTP::uri] contains "/info/capacity" {
if {[active_members pool_test1 ] >0 } {
pool pool_test1
} else {
pool pool_sorry
}
} "/execution/v1" {
if {[active_members pool_test2 ] >0 } {
pool pool_test2
}
} else {
pool pool_sorry2
}
}
ERROR
01070151:3: Rule [/Common/test_iRules] error: /Common/test_iRules:2: error: [undefined procedure: /info/capacity][/info/capacity]
/Common/test_iRules:8: error: [undefined procedure: /execution/v1][/execution/v1]
/Common/test_iRules:12: error: [undefined procedure: else][else]
I try to do this
contain "/info/capacity" & active_members pool_test1 >0 → pool_test1
contain "/info/capacity" & active_members pool_test1 <0 → pool_sorry
contain "/execution/v1" & active_members pool_test2 >0 → pool_test2
contain "/execution/v1" & active_members pool_test2 <0 → pool_sorry2
Thanks
You're syntax is slightly off, try this
when HTTP_REQUEST { switch [HTTP::uri] { "/info/capacity" { if {[active_members pool_test1 ] >0 } { pool pool_test1 } else { pool pool_sorry } } "/execution/v1" { if {[active_members pool_test2 ] >0 } { pool pool_test2 } else { pool pool_sorry2 } } } }
- Lee_SutcliffeNacreous
You're syntax is slightly off, try this
when HTTP_REQUEST { switch [HTTP::uri] { "/info/capacity" { if {[active_members pool_test1 ] >0 } { pool pool_test1 } else { pool pool_sorry } } "/execution/v1" { if {[active_members pool_test2 ] >0 } { pool pool_test2 } else { pool pool_sorry2 } } } }
- yuniAltostratus
Thank you so much, Lee Sutcliffe
It works well!!
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