irule matching variable in uri
We are having trouble with an irule that matches a value in a uri and send it to a different pool.
The value is the last 2 digits in the uri
example:
https://testinguri.dev.no:443/A2ABC/GT_1078_Human_v1/api/?env=02
https://testinguri.dev.no:443/C2CDC/GT_1095_Mail_v1?05
https://testinguri.dev.no:443/C2CDC/GT_2000_Process_v1?08
We are trying to match by this value and send the request to a different pool. If nothing matches it should go to the default pool
We tried a data group with the string values and used this irule
for example with the uri below:
iRule 1
when HTTP_REQUEST {
if { ( [class match [string tolower [HTTP::uri]] equals mt_envir_dg] ) } {
pool variable_pool
}else { pool normal_pool}}
We also tried the following irule
iRule 2 (Does not match)
when HTTP_REQUEST {
if { [HTTP::uri] contains "/A2ABC/" && ([HTTP::uri] contains "?02" || [HTTP::uri] contains "?05" || [HTTP::uri] contains "?env=02" || [HTTP::uri] contains "?env=05") } {pool variable_pool } else {pool normal_pool
Hello, this should do
when HTTP_REQUEST { if {[HTTP::path] starts_with "/A2ABC/" && [class match [HTTP::query]] eq query-data-group }{ pool variable_pool } }
I would suggest using a data-group for easier management and scalability on URI values, You'll need a string-type data group named "query-data-group" (to match my example) populated like this
ltm data-group internal query-data-group { records { env=02 { } env=05 { } } type string }
Regards
CA