Forum Discussion
Add elseif is to iRule syntax errors
This iRule was working originally but now I need to add a If in the beginning and move /mrgram to an esleif...I cant get the syntax working, I could use some help.. Logic is... 1. If uri starts with /WebTrans/webs.aspx > redirect to othersite 2. Elseif uri starts with mgram/mgram & not one of valid IPs send redirect back as host. 3. othewise continue normal. ! when HTTP_REQUEST { if { ( [string tolower [HTTP::uri]] starts_with "/WebTrans/webs.aspx*" ) } { HTTP::redirect "; elseif { ( [string tolower [HTTP::uri]] starts_with "/mgram/mgram.asmx" ) } { if { not ( [IP::addr [IP::client_addr] equals "10.10.10.10"] or [IP::addr [IP::client_addr] equals
"20.20.20.20"] or [IP::addr [IP::client_addr] equals "30.30.30.30"] ) } { HTTP::redirect "https://[HTTP::host]/" } } }
1 Reply
- crodriguezRet. Employee
Try this notation:
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] starts_with "/WebTrans/webs.aspx*" } { HTTP::redirect "https://othersite.bigfcu.org/" } elseif { [string tolower [HTTP::uri]] starts_with "/mgram/mgram.asmx" } { if { not ( [IP::addr [IP::client_addr] equals "10.10.10.10"] or [IP::addr [IP::client_addr] equals "20.20.20.20"] or [IP::addr [IP::client_addr] equals "30.30.30.30"] ) } { HTTP::redirect "https://[HTTP::host]/" } } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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