Forum Discussion

TJ_Vreugdenhil's avatar
Jan 21, 2015

Expected boolean value error - iRule 11.4.1

Any help with the brackets placement?

when RULE_INIT {
     v1.0 - ACL to block /jadu from outside networks
     January, 2015
}
when HTTP_REQUEST  {
    if { [string tolower [HTTP::uri]] starts_with "/jadu"  &&  ! [class match [IP::client_addr] equals forward-slash-jadu-allow-networks] } {
    log local0. "Invalid client IP & URI: [IP::client_addr] - discarding"
    HTTP::redirect "http://site.com/site/custom_scripts/unauthorized.php"
    }
}


ltm data-group internal forward-slash-jadu-allow-networks {
    records {
        10.20.1.0/24 { }
        10.60.0.0/16 { }
    }
    type ip
}

Jan 21 10:59:58 loadbalancer1 err tmm[8230]: 01220001:3: TCL error: /Common/forward-slash-jadu-allow-networks_iRule  - expected boolean value but got " [string tolower [HTTP::uri]] starts_with "/jadu" "     while executing "if { { [string tolower [HTTP::uri]] starts_with "/jadu" } && { ! [class match [IP::client_addr] equals forward-slash-jadu-allow-networks] } } {

1 Reply

  • Hi TJ,

    some brackets will do the job:

    if { ([string tolower [HTTP::uri]] starts_with "/jadu")  &&  ! ([class match [IP::client_addr] equals forward-slash-jadu-allow-networks]) }

    Thanks, Stephan