Forum Discussion

Livius's avatar
Livius
Icon for Cirrus rankCirrus
Jul 16, 2018

iRule event order

Hi,

 

I have the following iRule in which both ifs are matched :

 

Code    
    when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
report  {pool HSL_pool
  log local0. "seq1 match"
    }
    }
    if { [IP::addr [IP::client_addr] equals 10.10.10.1] }  {
    pool test_pool
    log local0. "seq2 match"
            }
    }

Which event will be matched? HTTP_REQUEST or IP::addr?

 

  • Surgeon's avatar
    Surgeon
    Ret. Employee

    You have one event only - HTTP_REQUEST. IP::addr is a command

     

    In your case you need read like next:

     

    During http request check for client IP. If client IP is equal to 10.10.10.1 then use pool test_pool and write "seq2 match" to log file.