Trying to configure an irule to redirect from one server/uri to a different server and only keep the query after the uri
For example -
http://www.host.com/hello/thisisatest (or anything else after the /hello) redirects to http://newhost.com/thisisatest (or anything else after the /hello above)
Is the first part of the URI static, or do you need to remove the first part of the URI no matter what it is? If the former, a simple string map should cover it:
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] starts_with "/hello" } {
set newuri [string map {"/hello" ""} [HTTP::uri]]
if { $newuri eq "" } { set newuri "/" }
HTTP::redirect "http://[HTTP::host]$newuri"
}
}