Hello All,
After an upgrade from 4.5.10 to 9.1.1, I cannot for the life of me get this iRule to work. it’s pretty basic but for whatever reason, it doesn’t want to work. I have a VS listening on port 80 for web traffic coming in. based on the URI it will be directed to 1 of 3 pools I have setup. The HTTP requests will all come into http://webhost.domain.com/\_\_\_\_ . At the end of the request (URI) will either be /Jive, /WebNow, or a couple other strings. I need to direct requests containing “jive” to the Jive-Web pool, requests that contain “webnow” to the WebNow pool, and all others to the Weblogic pool. Any help is appreciated. Thank you.
when HTTP_REQUEST {
if { [HTTP::uri] matches “/jive” } {
use pool Jive_Web
}
elseif { [HTTP::uri] matches"/webnow" }{
use pool WebNow
}
else {
persist cookie insert wldevpool
use pool Weblogic
}
}
wrong script in there, I was trying to play with different commands to get it to work. this is the one that was upgraded and I am trying to use:
when HTTP_REQUEST {
if { [HTTP::uri] ==“/jive” } {
use pool Jive_Web
}
elseif { [HTTP::uri] ==“/webnow” }{
use pool WebNow
}
else {
persist cookie insert wldevpool
use pool Weblogic
}
}
thanks.
You mentioned that you want to direct traffic if the URI “contains” that string, which may be the problem. Try using the “contains” or “starts_with” operator instead. You might also want to make the comparison case-insensitive, and a switch statement might be in order as well -- try one of these:
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] contains "/jive" }{
pool Jive_Web
} elseif { [string tolower[HTTP::uri]] contains "/webnow" }{
pool WebNow
} else {
persist cookie insert wldevpool
pool Weblogic
}
}
or:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
Adjust wildcards as necessary.
"/jive* is equivalent to "starts_with /jive"
"*jive* is equivalent to "contains jive"
"/jive*" {
pool Jive_Web
}
"/webnow*" {
pool WebNow
}
default {
persist cookie insert wldevpool
use pool Weblogic
}
}
}
HTH
/deb
Thank you much! I switched it to use the contains and the tolower command and all is well. Thanks for the input!