# Redirect traffic to pools based on URI

**URL:** <https://community.f5.com/t/redirect-traffic-to-pools-based-on-uri/44514>\
**Category:** Technical Forums\
**Tags:** irules, ltm, application-delivery\
**Created:** [October 2, 2020, 3:44pm UTC](https://community.f5.com/t/redirect-traffic-to-pools-based-on-uri/44514 "2020-10-02T15:44:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nkroon1](https://avatars.discourse-cdn.com/v4/letter/n/97f17d/32.png) [@nkroon1](https://community.f5.com/u/nkroon1)\
**Post date:** [October 2, 2020, 3:44pm UTC](https://community.f5.com/t/redirect-traffic-to-pools-based-on-uri/44514/1 "2020-10-02T15:44:02Z")

</div>

Hello! So i’m running into some issues with trying to redirect traffic based on URI and I’m not sure if its my iRule or something else. I can see the traffic coming in, but in show connections it just states any6.any on the server side. I also ran a TCPDUmp and can see traffic coming in, and i can see it mentioning the correct pool I want it to go to, but it doesn’t seem to go communicate to it. I’m starting to think its my irule, but i’m not sure. Below is the irule that I have.

```tcl
when HTTP_REQUEST {
  switch -glob [string tolower [HTTP::path]] {
    "/qm.etl.services/*" {
        pool Pool_A
        log local0. "[IP::client_addr] redirected to Pool_A"
}
    "/identityprovider/*" {
        pool Pool_B
        log local0. "[IP::client_addr] redirected to Pool_B"
}
    default {
    pool Pool_C
    log local0. "[IP::client_addr] redirected to Pool_C"
}
}
}

```

Currently, it does compile fine and I get no errors when saving, however when I watch my logs I see 0 logging for any of the redirects to the pools, which is making me suspect that my irule is the issue. I’m not sure if i’m missing something, or what. Any suggestions would be appreciated!

Note: The software that is using this is called Questionmark.

---

<div class="post-metadata">

**Author:** ![patonbike](https://avatars.discourse-cdn.com/v4/letter/p/58956e/32.png) [@patonbike](https://community.f5.com/u/patonbike)\
**Post date:** [October 2, 2020, 5:42pm UTC](https://community.f5.com/t/redirect-traffic-to-pools-based-on-uri/44514/2 "2020-10-02T17:42:33Z")

</div>

You could try this as an alternative, and see if it works:

if [string tolower [HTTP::path]] starts\_with “/qm.etl.services” {

pool Pool\_A

log local0. “[IP::client\_addr] redirected to Pool\_A”

}

---

<div class="post-metadata">

**Author:** ![nkroon1](https://avatars.discourse-cdn.com/v4/letter/n/97f17d/32.png) [@nkroon1](https://community.f5.com/u/nkroon1)\
**Post date:** [October 2, 2020, 5:59pm UTC](https://community.f5.com/t/redirect-traffic-to-pools-based-on-uri/44514/3 "2020-10-02T17:59:48Z")

</div>

So i was finally able to get it to work. Turns out, I had the wrong protocol. They weren’t coming in on HTTP but just TCP. Ended up modifying the irule to include the following at the top and they are now correctly redirecting.

```tcl
when CLIENT_ACCEPTED {
if {[TCP::local_port] eq 5672 }
{ node xx.xx.xx.xx:5672 
HTTP::disable
}
}

```

After adding that, they are redirecting correctly now and were able to start up the software.
