Forum Discussion
Lee_Sutcliffe
Nov 13, 2017Nacreous
Good evening..
Seems to me you just want to rewrite URI between client and server. This can be done with [HTTP::uri] no need to collect the HTTP payload and complicated string replacement.
I've just put this very basic iRule together with should illustrate my thinking. I'm just setting a flag on HTTP request so that we know what to change the URI back to on response. Hopefully it might give you some ideas:
when HTTP_REQUEST {
set uri "/APP_APP1153/APP1153.ashx"
set g1 0
set g2 0
if {[HTTP::uri] equals "/G1/$uri" } {
[HTTP::uri] $uri
set g1 1
}
if {[HTTP::uri] equals "/G2/$uri" } {
[HTTP::uri] $uri
set g2 1
}
}
when HTTP_RESPONSE {
if {$g1} {
[HTTP::uri] "/G1/$uri"
}
if {$g2} {
[HTTP::uri] "/G2/$uri"
}
}
PS - I've not tested this (making the most of a delayed train! )