Add a prefix before sending the request to the Pool

Hi,

Scenario :

A single VS (3.3.3.3) with two different Pool based on the URI prefix :

Pool A: the member web server 1.1.1.1 is configured on a Virtual Directory /web

Pool B: the member web server 2.2.2.2 is configured on a Virtual Directory /reports

Requirement:

Client browser must connect to the root directory of the Virtual Server and the LTM will use Pool A and add the /web prefix before sending the request to the Pool except /reports which the LTM will use Pool B and pass through the URI with no changes

Example:

Can someone kindly enough to build the irules that meet the requirement above ?

Many thanks in advance.

Adrian.

Hi Scott, I typed my questions in the text editor and use markdown format. I am using Chrome Browser Version 28.0.1500.95

when HTTP_REQUEST {
if {[HTTP::uri] starts_with "/reports"}{
pool pool_b
} else {
HTTP::uri /web[HTTP::uri]
pool pool_a
}
}

OR

when HTTP_REQUEST {
if {[string tolower [HTTP::uri]] starts_with "/reports"}{
pool pool_b
} else {
HTTP::uri /web[HTTP::uri]
pool pool_a
}
}

You’ll probably also want a OneConnect profile assigned to the VIP.

just in case you have not yet seen this solution.

sol9800: Using an iRule to load balance HTTP requests to multiple pools

Thank you very much for all the help.

I have finally get it working and here is the final irules that I use. I add some log command as a troubleshooting tool to log the variable in the /var/log/ltm

Add /web prefix 
 Unless it started with /reports

when HTTP_REQUEST {

  log local0. "in HTTP_REQUEST"

  set orguri [HTTP::uri]
  log local0. "Original: $orguri."  

if {[string tolower $orguri] starts_with "/reports"}
  {
  pool pool_b
  }
else {
    set newuri "/web[HTTP::uri]"
    HTTP::uri $newuri 
    pool pool_a
    }
log local0. "After mapping: [HTTP::uri]"
log local0. "Pool: [LB::server pool]"
}