Forum Discussion

eliton_199802's avatar
eliton_199802
Icon for Nimbostratus rankNimbostratus
Jun 26, 2018

iRule expression error

Can somebody please assist me with the following irule, I receive the following error: security:9: error: [missing an expression][ ]

when HTTP_REQUEST { lowercase the host string received switch -glob [string tolower [HTTP::uri]] { "/" { HTTP::redirect "/123/login" }

        "/123/adminconsole.jsp"
            if { [IP::addr [IP::client_addr] ne 10.0.0.0/8%5] } {
             Drop the connection
            reject
    }

}

}

1 Reply

  • Seems you are missing some curly brackets in your switch statement, right above and below your if statement.

    when HTTP_REQUEST { 
         lowercase the host string received 
        switch -glob [string tolower [HTTP::uri]] {
            "/" { 
               HTTP::redirect "/123/login"
            }
    
            "/123/adminconsole.jsp" {
                if { [IP::addr [IP::client_addr] ne 10.0.0.0/8%5] } {
                 Drop the connection
                reject
                }
            }
    
        }
    }