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 ...
Michael_Yates
Sep 11, 2012Nimbostratus
Hi Brian,
You are already most of the way there with what you need, but you were performing the same process for both of them.
The "-" on the end tells the qualifying event to perform the same action as the next event, so you need to seperate the actions for each specific HTTP::uri.
In a switch statement the values in the "" are literal, so these are detecting the first part of the URI Path do differentiate them. The -glob allows for the use of the "*" Wildcard which will match anything else after what you are looking for.
"/vendorABC/status.asp*"
"/vendorXYZ/status.asp*"
Also, in your switch statement you are performing a string to lower for the comparison, so when you are performing a string tolower make sure that the values are all in lower case so that you get a match.
"/vendorABC/status.asp*"
"/vendorXYZ/status.asp*"
Should be:
"/vendorabc/status.asp*"
"/vendorxyz/status.asp*"
Try this:
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
}
}
}
Hope this helps.
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