Forum Discussion
Marcus_Hong_Yu
Nimbostratus
Jul 20, 2018irule to rewrite uri in http request and response
Hi Guys, really need to borrow your expertise. recently I ran into a request from our application team. they currently have an existing environment configured on LTM. They want to create a new pool o...
JG
Cumulonimbus
Jul 20, 2018Try this:
when HTTP_REQUEST {
if { [string tolower [HTTP::path]] starts_with "/review2"} {
HTTP::path [string map { "/review2" "/review" } [HTTP::path]]
pool pool_2
} else {
pool pool_1
}
}
when HTTP_RESPONSE {
if { [class match [IP::server_addr] equals private_net] } {
if { [HTTP::header exists "Location"] } {
HTTP::header replace Location [string map { "/review/" "/review2/" } [HTTP::header Location]]
}
STREAM::expression {@/review/@/review2/@}
STREAM::enable
} else {
STREAM::disable
}
}
when STREAM_MATCHED {
STREAM::replace
log local0. "String matched and replaced."
}
.
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