How to use string map to set and insert a part of the URI to the destination redirect irule
How to use string map or other TCL methods to set and insert a part of the URI to the destination redirect irule. I have a requirement to look for a URI path in a request and use that to set a URI path for the redirect endpoint we would redirect the client to. A part of the redirect URI is predefined and the later part of the redirect URI would have to filled out on the go based on the contents initial clients URI path. I have the clients request come in as
1)
https://www-xxxxxxx.com/logout-apm?post_logout_redirect_uri=/includes/logged_out.aspx
The end result of the redirect endpoint should be
2)
the the post_logout_redirect_uri part of 2)'s URI should be formed on the fly by F5 by learning 1)'s host name www-xxxxxx.com and the rest of the URI emitting the "logout-apm" from it.
I thought we could use string maps to establish this, so i am trying something with that but without success, here is where i am at right now
when HTTP_REQUEST {
set host [HTTP::host]
set uri [HTTP::uri]
if
{$uri contains
"/logoutapm"} {
set HTTP::uri [string
map {logoutapm?post_logout_redirect_uri=/includes/logged_out.aspx
common/oauth2/v2.0/logout?post_logout_redirect_uri=https://$host/includes/logged_out.aspx} "logoutapm?post_logout_redirect_uri=/includes/logged_out.aspx"]
HTTP::redirect
"https://login.microsoftonline.com/[HTTP::uri]"
}
}
trying to see if there is a better alternative to this approach, this syntax and logic are not giving the desired redirect endpoint.