Forum Discussion
dundovic_25174
Oct 05, 2011Nimbostratus
Missing a script after "if"
I'm testing an iRule that'll redirect to a specific site in case both specific user agent and specific cookie are contained in request. I wrote following:
---
when HTTP_REQUEST {
if { [class match [HTTP::header "User-Agent"] contains list_of_agents] }
if { [HTTP::cookie exists "OREO"] and [HTTP::cookie value "OREO"] ne "empty"} then {
HTTP::redirect "http://site1/"
log local0.info "REDIR" } else {
HTTP::redirect "http://site2"
log local0.info "NOREDIR" }
}
---
and I'm getting 'Missing a script after "if"' error in line 4. If I use only one of those 'if' lines, it's working fine. Could somebody shed some light where's the problem coming from? I understand it's a syntax issue but I can't figure it out...
Thanks...
D.
- nitassEmployeecan u try this?
when HTTP_REQUEST { if {[class match [HTTP::header "User-Agent"] contains list_of_agents]} { if {[HTTP::cookie exists "OREO"] and [HTTP::cookie value "OREO"] ne "empty"} { HTTP::redirect "http://site1/" log local0.info "REDIR" } else { HTTP::redirect "http://site2" log local0.info "NOREDIR" } } }
- dundovic_25174NimbostratusThanks Nitass, that did the trick. ah, braces, braces, TCL...;)...
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