Forum Discussion

SteveMP's avatar
SteveMP
Icon for Nimbostratus rankNimbostratus
Mar 28, 2019

TCL errors on iRule

I have an iRule that looks at the source IP, tries to match the IP address to one in a data group list, and if it matches it sends it to a specific pool. This works in one region, but I copy and pasted the iRule into another region onto our F5s there, and the same iRule fails. I copied the iRule, recreated the data group list with same name, copy and pasted pool name etc. However on this new region I noticed that no traffic hits the pool. The iRule statistics show it getting hit and succeeding, but traffic keeps going to the default pool of the virtual server. I did notice on the F5s in the region this is failing in are some TCL errors.

 

Here is the errors (multiple similar with various "invalid command name" but the EWS is the main one I need to work:

 

TCL error: /Common/O365_Direct_EWS - invalid command name "/EWS/Exchange.asmx" while executing "[HTTP::uri]"

 

And here is the iRule:

 

when HTTP_REQUEST {if { ( [string tolower [HTTP::uri]] contains "/ews/") && [class match [IP::client_addr] equals "O365_Exchange_Online_IPv4" ] } {pool /Common/AP_EXT_O365_Exchange_Online_Direct}}

 

2 Replies

  • Hi Steve,

    i have an idea how to figure out whats going wrong...

    when HTTP_REQUEST {
        if { [catch {
             Lets try this...
            if { [string tolower [HTTP::uri]] contains "/ews/" } then {
                if { [class match [IP::client_addr] equals "O365_Exchange_Online_IPv4" ] } then {
                    pool /Common/AP_EXT_O365_Exchange_Online_Direct
                } elseif { [class match [IP::client_addr] equals "O365_Exchange_Online_IPv4" ] != [class match [getfield [IP::client_addr] "%" 1] equals "O365_Exchange_Online_IPv4" ] } then {
                    log local0.debug "Reminder to myself the other region uses Route Domain suffixes..."
                }
            }
    
        }] } then {
             Something strange is going on and has crashed TCL
            log local0.debug "Extended Error: [subst "\$::errorInfo"]"
        }
    }
    

    Cheers, Kai

  • Hi Steve,

    For information EWS Path will always begin wit /ews/...

    Answer above from Kai is fine, it will catch you error but this irule will not redirect you to the right pool because URI check fails...

    So you can try this irule:

    when HTTP_REQUEST {
    
    set uri [string tolower [HTTP::path]]
    
    if { ($uri starts_with "/ews") && ([class match [IP::client_addr] equals "O365_Exchange_Online_IPv4"]) } {
    
        pool /Common/AP_EXT_O365_Exchange_Online_Direct
    
    }
    }