Forum Discussion
Jad_Tabbara__J1
Jul 26, 2017Cirrostratus
Hello Aandrey,
I read you comments, I think that what you need to do is to rewrite all response coming from Newpool containing URL that points to /url.
You need to add a "SREAM PROFILE" to your VS and use the following irule example :
when HTTP_REQUEST {
set rewrite "0"
set host [string tolower [HTTP::host]]
if { [ string tolower [HTTP::uri]] starts_with "/url" } {
pool oldpool
} elseif { [string tolower [HTTP::uri]] starts_with "/newurl" } {
set rewrite "1"
STREAM::disable
HTTP::header remove "Accept-Encoding"
pool NewPool
}
}
when HTTP_RESPONSE {
Make rewrite only for responses coming from pool NewPool
if { rewrite eq "1" } {
if {[HTTP::header exists Location] } {
if { [string tolower [HTTP::header Location]] contains "/url/"} {
log local0. "Old Location is: [HTTP::header Location]"
HTTP::header replace Location [string map {"/url/" "/newurl/"} [HTTP::header Location]]
log local0. "New Location is: [HTTP::header Location]"
}
}
if {[HTTP::header value Content-Type] contains "text" || [HTTP::header value Content-Type] contains "xml" }{
Will replace all links in text or xml "Content-Type" that contains yourapp.doamin.com/url by yourapp.doamin.com/newurl
STREAM::expression "@$host/url@$host/newurl@"
STREAM::enable
}
}
}
Hope it helps
Regards