Forum Discussion

PG0581's avatar
PG0581
Icon for Cirrus rankCirrus
Apr 05, 2018

Redirect 2 URLs to one specific pool member

I'm new to creating iRules and would like to redirect URLs containing "/abc/123/" or "/def/456/" to a pool pool_abc and the specific pool member 1.1.1.1:port

 

Will this work? Or am I way off?

 

when HTTP_REQUEST { if { ( ([HTTP::uri] contains "/abc/123/") or ([HTTP::uri] contains "/def/456/") ) } { pool pool_abc member 1.1.1.1:port log local0. "[IP::remote_addr] URI: [HTTP::uri]" }

 

} }

 

1 Reply

  • Yes you can go with that, but your pool member selection part may be wrong,

    when HTTP_REQUEST {    
       if { ( [string tolower [HTTP::uri]] contains "/abc/123/" ) || ( [string tolower [HTTP::uri]] contains "/def/456/" ) } {       
          pool pool_abc member 1.1.1.1 80
          log local.0 "URI contains condition matched, member 1.1.1.1 80 selected"
       } else {      
          pool different_pool
          log local.0 "URI contains condition  NOT matched, different_pool selected"
       }
    }