If / else not working
BigIP v11.5.1
Attempting to write an irule that redirects to different pools based on URI - super basic, but for some reason when adding the rule into the LTM console, it errors out when using ELSE. If I update it to use ELSEIF then it works. However, the logic as it is below is how I would like it, only if it sees the URI of /loyaltyapi does it redirect, otherwise it goes to the default pool for the Virtual Server.
Here is my iRule
when HTTP_REQUEST {
if { [string tolower [HTTP::path]] starts_with "/loyaltyapi" } {
pool rcv100crw-pool-http
}
else {
pool rcv100cwb-pool-http
}
}
when I put that into the LTM, I get the following errors:
01070151:3: Rule [/Common/api_redirect_http] error: /Common/api_redirect_http:2: error: [undefined procedure: &160][ ] /Common/api_redirect_http:5: error: [undefined procedure: else][else { pool rcv100cwb-pool-http }]
Any guidance would be greatly appreciated.