Forum Discussion

Graziano_Rizzat's avatar
Graziano_Rizzat
Historic F5 Account
Nov 27, 2007

issue to match datagroup string value with URI variable

Hello,

 

 

The irule we are working on is a simple redirect to https when there is a match between uri user request and string on data group.

 

 

Unfortunatly something on the matching statement is wrong because there isn't a match even if the user uri request is the same as the datagroup string. Here is the irule:

 

 

class urilist {

 

"/px/"

 

}

 

 

rule test-plugin {

 

when HTTP_REQUEST {

 

log local0. "requested host is [HTTP::host] uri starts with [HTTP::uri]"

 

if { [HTTP::uri] starts_with $::urilist}{

 

HTTP::redirect "https://[HTTP::host][HTTP::uri]"

 

}

 

else {

 

log local0. "requested uri is not into the datagroup [HTTP::uri]"

 

log local0. $::urilist

 

pool pool-www.farm

 

}

 

}

 

}

 

 

Log messages when user ask for /ag/ uri:

 

 

Nov 26 17:47:59 bigip1 tmm[1095]: Rule test-plugin : requested host is test.www.farm.csebo.it uri starts with /ag/

 

Nov 26 17:47:59 bigip1 tmm[1095]: Rule test-plugin : requested uri is not into the datagroup /ag/

 

Nov 26 17:47:59 bigip1 tmm[1095]: Rule test-plugin : {/px/}

 

 

Log messages when user ask for /px/ uri:

 

 

Nov 26 17:48:04 bigip1 tmm[1095]: Rule test-plugin : requested host is test.www.farm.csebo.it uri starts with /px/

 

Nov 26 17:48:04 bigip1 tmm[1095]: Rule test-plugin : requested uri is not into the datagroup /px/

 

Nov 26 17:48:04 bigip1 tmm[1095]: Rule test-plugin : {/px/}

 

 

 

Your help will be appreciated

 

 

Thanks

 

3 Replies

  • Hi,

     

     

    The rule and class look fine. I wonder if this is an oddity withe the starts_with comparison. Do you get the same problem if you make a request for /px/test or anything else that starts with /px/ but is longer?

     

     

    Aaron
  • Hi,

     

     

    I try with a longer uri but the response is always the same; it seems that the test doesn't read the class urilist!!

     

     

    In fact, I try with another iRule in which I don't use the class urilist but the test include directly "/px/", like this:

     

     

    if { [HTTP::uri] starts_with "/px/"}

     

     

    and in this way works correctly. But this in not the solution!!

     

     

    Thanks in advance