Forum Discussion

Daniel_104432's avatar
Icon for Nimbostratus rankNimbostratus
Sep 19, 2011

How to read a string + value from a data group list

Hello there,


i've got some trouble with a datagroup list. We are using a lot of lists to match strings against client host requests but now I want to use the value of the matched string for a redirect destination.



So in detail i want to do something like this:


1. A client asks for


2. The Bigip is getting the request and is matching it against the data group list foobar_list.


3. The host matches and the bigip is doing a redirect to ""



class foobar_list {


"" { "" }






The reason I want to do it like this is to get away from one irule per redirect. We have way to much irules only for simple redirects. But I don't understand how to use the value.



I hope something like this is working:


if { [matchclass [HTTP::host] contains $::foobar_list] }




HTTP::respond 301 Location [vlaue of]





I only need to know how to get the value :)



thanks in advance.


2 Replies

  • Hi Daniel,

    I created an example for you. In my example I capture the "-value" of a matching "-name" and store it in a variable. In the if statement, if a match was found and the value is not empty then it will redirect to the location.

    I am providing the Data Group and the iRule so that you can make modifications and test with hit.

    class string_value_test_group {
          "/foo" { "" }
          "/foofoo" { "" }
          "/foofoofoo" { "" }
    when HTTP_REQUEST {
    set redirecturl [class match -value [string tolower [HTTP::uri]] starts_with string_value_test_group ]
    if { $redirecturl ne "" } {
    HTTP::respond 301 Location $redirecturl

    Hope this helps.