Forum Discussion

nkroon1's avatar
nkroon1
Icon for Cirrus rankCirrus
Oct 02, 2020

Redirect traffic to pools based on URI

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.

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.

  • 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"

    }

     

     

  • 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.

    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.