Forum Discussion
Brian_Kenworthy
Aug 30, 2012Nimbostratus
Redirect to New Page but Pass Query String Parameters
Hi All,
Need some advice on what an iRule would look like to do this....We are moving from legacy ASP listeners to .net listeners, but we don't want the client to change their endpoint until they are ready. So here's what it we are looking to do:
redirect requests destined for:
https://my.domain.com/vendor/status.asp?user=xxx&password=yyy
to
https://my.domain.com/vendor/status.aspx?user=xxx&password=yyy
I know how to redirect the whole URI, but am confused about how to change just one piece:
when HTTP_REQUEST {
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
Thanks for your help in advance!!
BK
- Michael_YatesNimbostratusHi Brian,
when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "/client/order.asp*" - "/vendorabc/status.asp*" { log local0. "Rewriting [HTTP::uri] to [string map -nocase {{VendorABC} {Listeners} {status.asp?} {abcstatus.ashx?}} [HTTP::uri]]" HTTP::uri [string map -nocase {{VendorABC} {Listeners} {status.asp?} {abcstatus.ashx?}} [HTTP::uri]] pool beta.res-direct.com_B2B_HTTP } "/vendorxyz/status.asp*" { log local0. "Rewriting [HTTP::uri] to [string map -nocase {{VendorXYZ} {Listeners} {status.asp?} {xyzstatus.ashx?}} [HTTP::uri]]" HTTP::uri [string map -nocase {{VendorXYZ} {Listeners} {status.asp?} {xyzstatus.ashx?}} [HTTP::uri]] pool beta.res-direct.com_B2B_HTTP } } }
- Brian_KenworthyNimbostratusPerfect, this is working exactly as we expect. Thanks so much for the explanation of the rule elements Michael, that helps to understand exactly what's happening.
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects