Forum Discussion
Stuart_Buck
Oct 15, 2019Nimbostratus
Rewrite URI in multiple places
Hi all, Hoping to get some assistance please with the following. So a request will come into the LTM such as; https://dev-portal.domain.com.au/bpointcallback/206752391256402?ResponseCode=0&Respon...
- Oct 15, 2019
Hi
If you want to replace one string with another then you could use string map. The code would look something like
when HTTP_REQUEST { log local0. "Before Change: [HTTP::host] - [HTTP::uri]" if {([HTTP::host] eq "dev-portal.domain.com.au") && ([HTTP::uri] starts_with "/bpointcallback/")}{ HTTP::header replace Host "dev-portal5.sub.domain.com.au" HTTP::uri [string map -nocase [list "/bpointcallback/" "/apex/f?p=ARPAY:BPOINTRESP:" "?ResponseCode" ":::::?ResponseCode"] [HTTP::uri]] log local0. "After Change: [HTTP::host] - [HTTP::uri]" } }
iaine
Oct 15, 2019Nacreous
Hi
If you want to replace one string with another then you could use string map. The code would look something like
when HTTP_REQUEST {
log local0. "Before Change: [HTTP::host] - [HTTP::uri]"
if {([HTTP::host] eq "dev-portal.domain.com.au") && ([HTTP::uri] starts_with "/bpointcallback/")}{
HTTP::header replace Host "dev-portal5.sub.domain.com.au"
HTTP::uri [string map -nocase [list "/bpointcallback/" "/apex/f?p=ARPAY:BPOINTRESP:" "?ResponseCode" ":::::?ResponseCode"] [HTTP::uri]]
log local0. "After Change: [HTTP::host] - [HTTP::uri]"
}
}
- Stuart_BuckOct 17, 2019Nimbostratus
Thank you very much for that!!!
Just had to redirect it and works perfect ;)
HTTP::respond 301 Location http://[HTTP::host][HTTP::uri]
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