Forum Discussion
Kai_Wilke
Feb 24, 2016MVP
Hi Sysop,
you may try the
[getfield [LB::server addr] "%" 1]
syntax to strip the route domain before comparsion. Alternatively compare [LB::server addr]
with "10.80.9.113%1
", "10.80.9.94%1
" or "10.80.9.104%1
"
when HTTP_REQUEST_SEND {
clientside {
if { ([HTTP::uri] equals "/") } then {
switch -exact -- [getfield [LB::server addr] % 1] {
"10.80.9.113" {
HTTP::uri "[HTTP::uri]rp"
log local0. "[HTTP::uri]"
if {$static::rewrite_debug}{log local0. "[IP::client_addr]:[TCP::client_port]: HTTP uri path rewritten with rp"}
}
"10.80.9.94" {
HTTP::uri "[HTTP::uri]rp1"
log local0. "[HTTP::uri]"
if {$static::rewrite_debug}{log local0. "[IP::client_addr]:[TCP::client_port]: HTTP uri path rewritten with rp1"}
}
"10.80.9.104" {
HTTP::uri "[HTTP::uri]rp2"
log local0. "[HTTP::uri]"
if {$static::rewrite_debug}{log local0. "[IP::client_addr]:[TCP::client_port]: HTTP uri path rewritten with rp2"}
}
}
}
}
}
Note: Change a little bit the order of your
and [if]
nestings to optimize the performance.[switch]
Cheers, Kai