coriolis_75734
Feb 04, 2014Nimbostratus
Redirect based on datagroup
I have an iRule which checks to see if the URI is listed within a datagroup and then does a redirect to the value for that URI within the datagroup.
Now the customer would like it to check for the URI plus a trailing / (e.g. /redirectme/ as well as /redirectme ) but the data group list only contains the URI's without the trailing /. The data group has hundreds of entries so adding all the URI's again including the / is out of the question. My iRule is currently:
if { [class match [HTTP::uri] eq datagroup_uri_list] } {
HTTP::respond 302 Location "[class match -value [HTTP::uri] eq datagroup_uri_list]"
}
What would be the best way to add a / to the end of the datagroup_uri_list entries so they can be compared to the URI?
I assume it'll be something like:
if { [(class match [HTTP::uri] eq datagroup_uri_list] || class match [HTTP::uri] eq datagroup_uri_list]+/ } {
HTTP::respond 302 Location "[class match -value [HTTP::uri] eq datagroup_uri_list]"
}