Forum Discussion
sysop_182859
Nimbostratus
Feb 23, 2016URI rewrite based on chosen pool member
The issue is I have servers behind the F5 that only listen on a specific uri. For site.com/login (incoming from users), there are say 3 servers that listen for the following: (server1) site.com/one...
Kai_Wilke
MVP
Feb 24, 2016Hi 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
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects