Forum Discussion

Lucas_Kaczmars1's avatar
Lucas_Kaczmars1
Icon for Altostratus rankAltostratus
May 20, 2019
Solved

irule - stop processing on condition match

Hello, I searched for this answer and I've found that using 'event disable all' should exit processing the irule below, but it still goes to the second 'if' statements and evaluates it. Can someon...
  • Lee_Sutcliffe's avatar
    May 20, 2019

    You could rewrite the iRule using nested 'if' statements so you don't need a return, that way, you only check the host header once

    when HTTP_REQUEST {
        if {[string tolower [HTTP::host]] eq "test.website.com"} {
            if {[string tolower [HTTP::path]] starts_with "/authentication"} {
                log local0. "Accepted request test.website.com/authentication [HTTP::uri] for client [IP::client_addr]"
            } else {
                log local0. "Rejected request test.website.com [HTTP::uri] for client [IP::client_addr]"
                reject
            }
        }
    }