Forum Discussion

Nick_Palmer_f5's avatar
Nick_Palmer_f5
Icon for Nimbostratus rankNimbostratus
Apr 24, 2012

iRule Redirect Issue

Greetings!

 

 

I needed to separate traffic to URIs containing /specific/folder/ in them. So, I created a simple iRule that, I thought, would do that:

 

 

when HTTP_REQUEST {

 

set my_uri [string tolower [HTTP::uri]]

 

if { $my_uri contains "/specific/folder/" } {

 

pool www.specificpool.com

 

}

 

}

 

 

All calls with /specific/folder/ in them should go to a different pool of servers, www.specificpool.com. All other calls should be directed to the original pool of servers. Instead I'm seeing all types of traffic on www.specificpool.com, both to /specific/folder/ and to other folders as well.

 

 

Asking for your expertise to help me make sure no other calls but to /specific/folder/ end up in www.specificpool.com. Greatly appreciate your time!
  • I'd expect this to use your default pool but let's add an else just in case:

    
    when HTTP_REQUEST { 
          set my_uri  [string tolower [HTTP::uri]]
          if { $my_uri contains "/specific/folder/" } { 
              pool www.specificpool.com
          } else {
              pool default_pool
          }
    }
     
  • Hi Chris, and thank you for the solution! It worked great. I do appreciate your help.
  • I recommend doing this with a HTTP policy. should be very easy to add any specific URL and direct it to a pool... you can add rules for each URI and a default "catch-all" rule that forwards everything else to all.