Forum Discussion
tatmotiv
Cirrostratus
Feb 26, 2016pool-member specific rewrite of http URI
Hi everybody,
I have the following requirement:
There is a pool consisting of two members (same IP, different port). HTTP requests coming in to the according virtual must be rewritten as follows:...
Kai_Wilke
MVP
Feb 26, 2016Hi Tatmotiv,
you may try to use the HTTP_REQUEST_SEND event. This event will trigger after LB_SELECTED has choosen the member and also on every subsequent HTTP request...
when HTTP_REQUEST_SEND {
clientside {
if { [HTTP::uri] starts_with "/abc/" } {
if { [LB::server port] equals 8001 } {
HTTP::uri "/def[string range [HTTP::uri] 4 end]"
}
elseif { [LB::server port] equals 8002 } {
HTTP::uri "/ghi[string range [HTTP::uri] 4 end]"
}
}
}
}
Note: I've changed your code to use [string range] command in combination with substitution. Its much more stable and also performant to just cut/add the leading portion that needs to become replaced. You may have to change the 4 to the length of the string that needs to become cutted.
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