I’m a relative newbie to iRules, so please don’t laugh if this is too simplistic.
I also have two environments, call them primary and test. I use essentially the same rule (copy/paste) for the two; they differ only by the pools they direct traffic to which is determined by the URI.
Here’s the rule for the primary site:
when HTTP_REQUEST {
if {[HTTP::uri] matches_regex “/MyURIString” } {
pool alt_pool
} else {
pool main_pool}
}
The rule for the test site:
when HTTP_REQUEST {
if {[HTTP::uri] matches_regex “/MyURIString” } {
pool alttest_pool
} else {
pool maintest_pool}
}
The rule for the primary site works fine, regardless of the case of the URI.
As a general rule of thumb you should always do your compare with your data in a “known” state, so doing a string tolower will always help and make sure that the compare works.
If you change this line to this, it should resolve your problem:
if {[string tolower [HTTP::uri]] matches_regex “/myuristring” } {
What operating systems do each over your environments run on? I ask because for the most part IIS hosted Websites are case insensitive, but UNIX hosted applications are case sensitive.