Forum Discussion
Checking if a value exists in a data-group?
I've got an irule which doing 301 redirects. When a particular uri comes in, it checks the locale and matches it against a data-group with old locale in the uri being mapped to a new local.
For example "en_US" would map to "en-us" as the new value. It works fine for the most part, but if the locale that comes doesn't match a particular value in the data-group, it leaves the locale field blank in the 301 redirect. If the locale field in the uri contained something like /locale=en_ZZ, the redirect would just blank in the redirect.
Instead, we want it to redirect to a default page, and I'm not quite sure how to do that. First in the class match statement it would need to check if a matching value existed, but I'm not sure how to do that, and the class page on devcentral is a little confusing.
Hello atoth.
Make the most of the command 'else':
when HTTP_REQUEST { if { [class match [HTTP::uri] equals "location_dg" ] } { ## DO YOUR STUFF } else { ## DO YOUR STUFF IN CASE OF NOT MATCHING } }
Regards,
Dario.
Hello atoth.
Make the most of the command 'else':
when HTTP_REQUEST { if { [class match [HTTP::uri] equals "location_dg" ] } { ## DO YOUR STUFF } else { ## DO YOUR STUFF IN CASE OF NOT MATCHING } }
Regards,
Dario.
- atothCirrus
This worked. Thanks!
Great! Don't forget to tag the answer as 'the best' ;-)
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