Forum Discussion
Jim_Gray_43725
Feb 08, 2012Nimbostratus
http redirect based on path and query strings
I have a data group with 166 lines of source and target URLs for redirect. Most source URLs include 1 to 3 different queries. I need to find a way to match an incoming path and each query in any orde...
hooleylist
Feb 13, 2012Cirrostratus
Hi Jim,
You can parse individual query string parameters and their values using URI::query:
http://devcentral.f5.com/wiki/iRules.uri__query.ashx
I'm not sure what the most efficient way to handle the lookups would be though. Maybe you could always order the parameter values in the data group in the same order and then form the string to lookup in the same way.
For example, if you have a query string like:
param2=anothervalue¶m1=avalue¶m3=value3
you would parse the values for param1, param2 and param3, concatenate them and then do a lookup against the data group which has the param values combined in the same way:
set value [class match -value "[URI::query [HTTP::uri] param1]|[URI::query [HTTP::uri] param2]|[URI::query [HTTP::uri] param3]" equals query_string_parameters_dg]
Your data group would have the parameter values concatenated with pipes as well:
ltm data-group uri_to_pool_dg {
records {
anothervalue|avalue|value3 {
data match1
}
anothervalue2|avalue3|value5 {
data match2
}
}
type string
}
Aaron
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