Forum Discussion
PG0581
Cirrus
Apr 04, 2018Redirect 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
- jaikumar_f5
Noctilucent
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" } }