Our interactive team does not want the redirected URI to be cloaked and wants it to be displayed in full in the browser address area e.g. user enters www.123.com/checkthisout into browser and is redirected to www.123.com/tabid/1111/Default.aspx?showid=18828" with this full address appearing in their browser address area.
Question:
Can ProxyPass be configured to show the full URI of the redirect instead of ‘cloaking’ it?
If you send an HTTP redirect, the client will see the change in their address bar. If you rewrite the URI and/or host before sending the request to the server, the client will not see the change. So in concept you could modify the ProxyPassv10 iRule to send a redirect instead of rewriting the URI, but you’ll need to strip out a fair amount of code related to the rewriting. You can send a 302 redirect with HTTP::redirect or any HTTP response with HTTP::respond.
Here is an example which checks the HTTP path (set to lower case for IIS apps) and sends a 301 response based on the datagroup entries you have above. Note that I’ve removed all checks of the host. If you want to add handling for other hosts, you can put the switch inside a check on HTTP::host. If you want to check if the requested path starts with the strings, you can add the -glob flag to the switch and add a * to the end of the path(s):
Could I change this to an iRule as follows - how would you use string match for glob style wildcard pattern matching: (string match “*/tabid/786/*” [HTTP::uri])
That looks exactly correct. If as in your original post, you want to check for multiple patterns that use the same action, you can group them using a -
when HTTP_REQUEST {
Set the path to lowercase
switch -glob [string tolower [HTTP::uri]] {
"*/tabid/737/*" -
"*/tabid/746/*" -
"*/tabid/786/*" {
HTTP::respond 301 Location "http://www.123.com/error404.aspx"
}
}
}