Web redirections with data group fail if URI contains "?"
text
Hi Guys.
I have imported a huge preformated txt file of redirections in order to be managed in a data-group and be used in an irule applied to our vserver.
All seems to work fine and redirections are being managed in a right way. However I´m noticing this kind of redirections in the original txt file are being managed fine:
"/wines/mostsold/themostsold.asp" := "www.ourshop.com/shop/gourmetshop/",
But redirections with "?" character contained in the URI are not being managed like this one:
"/wines/product/product.asp?pRef=13345204286" := "www.ourshop.com/shop/gourmetshop/browse/productDetailCult.jsp?productId=A10111941",
This is the irule applied to our vserver:
when HTTP_REQUEST {
if {[TCP::local_port] == 443} {
set protocol "https"
} else {
set protocol "http"
}
set newuri [class match -value [string tolower [HTTP::uri]] equals redirections_gourmet301]
log local0. "URI IS: $newuri"
if {$newuri ne ""} {
HTTP::respond 301 noserver Location "$protocol://$newuri"
unset newuri
} else {
log local0. "URI IS NOT FOUND ON DATAGROUP"
}
}
It seems URI is not found on datagroup when URI contains "?" character. This kind of redirections managed in a irule containing IF URI equals...THEN redirect... sentences are managed fine, but i don´t know why they are not working fine in a datagroup.
Anybody coul tell my what is happening? Am i doing something wrong??
Thanks.
From your original post, I see that you are using upper case letters in your data group. When you are attempting to match a lower case HTTP::uri against it, it'll never match. Change your data group entries to use all lower case letters and see if that makes a difference for you.