Forum Discussion

Aboodi_1041's avatar
Aboodi_1041
Icon for Nimbostratus rankNimbostratus
Jun 30, 2012

irule meaning

Sorry for the newbie question but what does this iRule do ?

 

 

couldn't find a good explanation :

 

 

 

rule Persist_Universal {

 

when HTTP_REQUEST {

 

persist uie [ findstr [HTTP::uri] "?" 8 3 ]

 

}

 

}

 

 

 

 

 

what uri will match this rule ?

 

 

 

 

 

Thanks alot in advance !

 

4 Replies

  • hope this helps.

    [root@ve1024:Active] config  b virtual bar list
    virtual bar {
       snat automap
       pool foo
       destination 172.28.19.79:80
       ip protocol 6
       rules myrule
       profiles {
          http {}
          tcp {}
       }
    }
    [root@ve1024:Active] config  b rule myrule list
    rule myrule {
       when HTTP_REQUEST {
       log local0. "\[HTTP::uri\]: [HTTP::uri]"
       log local0. "\[findstr [HTTP::uri] ? 8 3\]: [findstr [HTTP::uri] ? 8 3]"
    }
    }
    
    [root@ve1024:Active] config  curl -I http://172.28.19.79/test?1234567890abcdef
    HTTP/1.1 404 Not Found
    Date: Sat, 30 Jun 2012 04:04:46 GMT
    Server: Apache/2.2.3 (CentOS)
    Content-Type: text/html; charset=iso-8859-1
    
    [root@ve1024:Active] config  tail -f /var/log/ltm
    Jun 29 21:04:34 local/tmm info tmm[4861]: Rule myrule : [HTTP::uri]: /test?1234567890abcdef
    Jun 29 21:04:34 local/tmm info tmm[4861]: Rule myrule : [findstr /test?1234567890abcdef ? 8 3]: 890
    
  • Thanks for your response nitass ,

     

     

    So I guess this iRule extracts the three characters after 8 ? starting with ? character ?
  • it finds ? character in url (HTTP::uri), skip 8 characters and return next 3 characters.

     

     

    findstr wiki

     

    https://devcentral.f5.com/wiki/irules.findstr.ashx