Forum Discussion
ProxyPass
Hi - hope this is the right place to pose this question
Background:
We are using the ProxyPass irule v10.2 to setup URI shortcode/keyword redirects (rewrites?) e.g. www.123.com/checkthisout redirecting to www.123.com/tabid/1111/Default.aspx?showid=18828" while retaining/cloaking the redirected URI i.e. only www.123.com/checkthisout displays in the browser address area.
Problem:
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?
- hooleylistCirrostratusIf 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.
- wrightnz_34708NimbostratusThanks!
- hooleylistCirrostratusHere 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):
when HTTP_REQUEST { Set the path to lowercase switch [string tolower [HTTP::path]] { "/land" { HTTP::respond 301 Location "/Shows/land/tabid/26/Default.aspx" } "/aw" { HTTP::respond 301 Location "/Shows/Advanced/tabid/45/Default.aspx" } "/attack" { HTTP::respond 301 Location "/Shows/Attack/tabid/14/Default.aspx" } "/plenty" { HTTP::respond 301 Location "/Shows/Plenty/tabid/27/Default.aspx" } "/blogs" { HTTP::respond 301 Location "/Shows/Blogs/tabid/93/Default.aspx" } "/op" { HTTP::respond 301 Location "/Shows/Plenty/tabid/57/Default.aspx" } "/derbury" { HTTP::respond 301 Location "/Shows/derbury/tabid/58/Default.aspx" } "/central" { HTTP::respond 301 Location "/Shows/Central/tabid/29/Default.aspx" } "/channel" { HTTP::respond 301 Location "/Shows/tabid/397/Default.aspx" } "/church" { HTTP::respond 301 Location "/Shows/derbury/tabid/58/Default.aspx" } "/events" { HTTP::respond 301 Location "/Events/tabid/699/Default.aspx" } default { Take some default action? } } }
- wrightnz_34708NimbostratusCheers - works great!
- hooleylistCirrostratusGood to hear you got this working.
- wrightnz_34708Nimbostratus
One more question if I may... can wildcards be used e.g. using siteurls.config to look for characters in URI and redirect
- hooleylistCirrostratusThat 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" } } }
- wrightnz_34708NimbostratusAWESOME!
Recent Discussions
Related Content
* 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