# Basic iRule not working after upgrade

**URL:** <https://community.f5.com/t/basic-irule-not-working-after-upgrade/3886>\
**Category:** Technical Forums\
**Tags:** irules, dev, devops, application-delivery\
**Created:** [December 19, 2006, 7:02pm UTC](https://community.f5.com/t/basic-irule-not-working-after-upgrade/3886 "2006-12-19T19:02:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_McCardle\_1](https://avatars.discourse-cdn.com/v4/letter/m/85f322/32.png) [@Mike\_McCardle\_1](https://community.f5.com/u/Mike_McCardle_1)\
**Post date:** [December 19, 2006, 7:02pm UTC](https://community.f5.com/t/basic-irule-not-working-after-upgrade/3886/1 "2006-12-19T19:02:49Z")

</div>

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/\_\_\_\_](http://webhost.domain.com/%5C_%5C_%5C_%5C_) . 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

}

}

---

<div class="post-metadata">

**Author:** ![Mike\_McCardle\_1](https://avatars.discourse-cdn.com/v4/letter/m/85f322/32.png) [@Mike\_McCardle\_1](https://community.f5.com/u/Mike_McCardle_1)\
**Post date:** [December 19, 2006, 7:08pm UTC](https://community.f5.com/t/basic-irule-not-working-after-upgrade/3886/2 "2006-12-19T19:08:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Deb\_Allen\_18](https://avatars.discourse-cdn.com/v4/letter/d/34f0e0/32.png) [@Deb\_Allen\_18](https://community.f5.com/u/Deb_Allen_18)\
**Post date:** [December 19, 2006, 8:06pm UTC](https://community.f5.com/t/basic-irule-not-working-after-upgrade/3886/3 "2006-12-19T20:06:47Z")

</div>

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:

```tcl
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:

```tcl
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

---

<div class="post-metadata">

**Author:** ![Mike\_McCardle\_1](https://avatars.discourse-cdn.com/v4/letter/m/85f322/32.png) [@Mike\_McCardle\_1](https://community.f5.com/u/Mike_McCardle_1)\
**Post date:** [December 20, 2006, 7:47pm UTC](https://community.f5.com/t/basic-irule-not-working-after-upgrade/3886/4 "2006-12-20T19:47:07Z")

</div>

Thank you much! I switched it to use the contains and the tolower command and all is well. Thanks for the input!
