14-Jul-2021 21:25
Hello
I am trying to redirect HTTP request from one service to another URL like below
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "service-api.xx.com" } {
HTTP::redirect "https://newservice.api.xx.com/test-cg[HTTP::uri]"
HTTP::header ????
}
}
so when client initiate a request the initial call comes to the F5 and F5 will redirect from service-api.xx.com to https://newservice.api.xx.com/test-cg[HTTP::uri] the redirection is happening as expected but looks like when the initial call is coming, comes with a header to send the auth to the the token key, the example of initial call is https://new-api.xx.com/auth/sessions so my question is how can i send the header and its value while i am redirecting the request.
Thanks
15-Jul-2021
02:17
- last edited on
04-Jun-2023
19:22
by
JimmyPackets
You can try below
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::host]] {
"service-api.xx.com"
{
if { [HTTP::header exists "Auth_header"] } {
set token [HTTP::header value Auth_header]
HTTP::respond 301 Location https://newservice.api.xx.com/test-cg[HTTP::uri]" "Auth_header" "$token"
return
}
} default {
return
}
}
}