cancel
Showing results for 
Search instead for 
Did you mean: 

iRule route traffic based on URI

Tom_DeBoeser
Nimbostratus
Nimbostratus

Hi,

  I've searched and used some irules trying to route browser connections based on the URI.  The problem I'm running into is there are many web instances on one host.  And the instances listen on multiple ports.

So simple enough:

 

ltm rule /Common/fusion-ports {
when HTTP_REQUEST {

switch -glob [HTTP::uri] {
    "/admin*" {
        node 10.31.43.85 8087
        log local0. "admin match"
        
    }
    "/Testing8*" {
        node 10.31.43.85 8089
        log local0. "test8 match"
    }
    "/Testing9" {
       node 10.31.43.85 8090
       log local0. "test9 match"
    default {
        HTTP::redirect "[HTTP::host]:8087
        log local0. "default match"
    }
}


}

 

I've used "pool" and [HTTP::redirect].  The problem is the website redirects, which changes the URI.  So I've tried inserting and using a combo of URI/cookie matching, but it doesn't work.  I get the same results.  ( can provide that code, if needed ). 

One of my questions is, has anyone had experience trying to do something similar?  My second question is, does the pool members' redirect take precedence over F5's cookie insertion?  tcpdump and logs don't help with this.

Thanks

 

2 REPLIES 2

Sebastiansierra
Cirrocumulus
Cirrocumulus

Hi,

Did you think to use LTM policies to simply the rules that you need and avoid future issues creating and modifying irules ? https://techdocs.f5.com/kb/en-us/products/big-ip_ltm/manuals/product/local-traffic-policies-getting-...

I didn't think about using a policy, I'm used to iRules so I started there.  I'll look into the policy process.  

 

Thanks