Forum Discussion
L4L7_53191
Feb 07, 2011Nimbostratus
Here's a quick example that lines up with the original URI based method...
when HTTP_REQUEST {
The first part of the URI should be a pool.
for this example, my pools are named "p_1" and "p_2",
so the URI of '/p_1/foo/bar.html will point to pool p_1,
then the cookie persistence will take care of subsequent requests.
NO default pool is set on the Virtual Server, and
use a cookie insert persistence profile on the VS.
Using variables for clarity.
set uri [HTTP::uri]
if { $uri ne "" } {
Set the pool name, strip off slashes.
set p [string map {"/" ""} [URI::path $uri 1 1]]
}
if {$p starts_with "p_"} {
log local0. "orig URI: $uri"
set newuri [string map "/$p/ /" $uri]
log local0. "New uri is: $newuri"
Set the new URI.
HTTP::uri $newuri
persist cookie
pool $p
log local0. "Selecting pool: $p, uri is [HTTP::uri]"
} else {
log local0. "Nothing to do, no pool in URI."
}
}
HTH,
-Matt