Forum Discussion

devrick0_22143's avatar
devrick0_22143
Icon for Nimbostratus rankNimbostratus
Feb 18, 2010

uri query question

I am new to irules and hoped someone could lend a hand. The idea behind the irule I am trying to write up is that when a request comes in, the irule pulls out a certain name=value pair and then routes that request using modulus.

 

 

Here is what I have so far.

 

 

when HTTP_REQUEST {

 

set baseip "10.1.1."

 

set baseoctet "25"

 

set basepool "app_pool_1"

 

set modulus "2"

 

log local0.info "URI: [URI::query [HTTP::uri] "rx"]"

 

set key [URI::query [HTTP::uri] "rx"]

 

if {$key != ""} {

 

set key [expr {$key % $modulus}]

 

set newoctet [expr {$baseoctet + $key}]

 

set memberip "$baseip$newoctet"

 

log local0.info "memberip: $memberip"

 

pool $basepool member $memberip:80

 

}

 

}

 

 

What I have found is that "rx" is not an exact match for a name. If the name is "trx" it will also match. It seems to be some sort of a regex. I have tried a few methods of regex, like "^rx", but none have limited the results to just "rx". If rx is found anywhere in the UI name values it is considered a match.
  • At least it seems to be fixed in v11.2.1HF8.

    I´ve tested versus:

    [URI::query [string tolower [HTTP::uri]] a]

    A query of "?aa=3&a=2&b=1&a=5" returns the first match: 2