Forum Discussion

Dan_Ecott_19303's avatar
Dan_Ecott_19303
Icon for Nimbostratus rankNimbostratus
Jan 04, 2007

Help with v9 conversion of iRule

Can anyone help with this iRule conversion I need to sort out.

 

 

Here is the old V4.x rule I was using. It simply does case matching for all possible URIs.

 

 

-----------------------8<-----------------------

 

 

if (http_uri matches_regex "^/[-a-zA-Z0-9_/]{1,35}\.[a-zA-Z0-9]{1,5}$" and http_header("Host") matches_regex "^[-a-zA-Z0-9\._]{1,30}(\:[0-9]{1,5})?$") {

 

use pool web_seal_pool

 

}

 

else if (http_uri matches_regex "^/[-a-zA-Z0-9_/]{1,100}\.[a-zA-Z0-9]{1,5}$" and http_header("Host") matches_regex "^[-a-zA-Z0-9\._]{1,100}(\:[0-9]{1,5})?$") {

 

use pool web_seal_pool

 

 

-----------------------8<-----------------------

 

 

Can anyone help?

 

 

Thanks.

1 Reply

  • This should be equivalent for 9.x:

    
    if { [HTTP::uri] matches_regex "^/[-a-zA-Z0-9_/]{1,35}\.[a-zA-Z0-9]{1,5}$" \
       && [HTTP::host] matches_regex "^[-a-zA-Z0-9\._]{1,30}(\:[0-9]{1,5})?$"}{
       pool web_seal_pool
    }
    elseif { [HTTP::uri] matches_regex "^/[-a-zA-Z0-9_/]{1,100}\.[a-zA-Z0-9]{1,5}$" \
       && [HTTP::host] matches_regex "^[-a-zA-Z0-9\._]{1,100}(\:[0-9]{1,5})?$" }{
       pool web_seal_pool
    }

    As the action is the same for either pair of conditions, you could combine them:

    
    if { ([HTTP::uri] matches_regex "^/[-a-zA-Z0-9_/]{1,35}\.[a-zA-Z0-9]{1,5}$" \
          && [HTTP::host] matches_regex "^[-a-zA-Z0-9\._]{1,30}(\:[0-9]{1,5})?$" ) 
       or ( [HTTP::uri] matches_regex "^/[-a-zA-Z0-9_/]{1,100}\.[a-zA-Z0-9]{1,5}$" \
          && [HTTP::host] matches_regex "^[-a-zA-Z0-9\._]{1,100}(\:[0-9]{1,5})?$") }{
       pool web_seal_pool
    }

    Aaron