Forum Discussion

Adrian_1807's avatar
Adrian_1807
Icon for Nimbostratus rankNimbostratus
Feb 17, 2010

Data group with special characters

Hi,

 

 

I have an iRule using a string data group. The iRule look for those strings in the HTTP header to do the correct balancing

 

 

Now i need to add new strings to the data group, but those strings include special characters like carriage return ( \n ) or somethings like that.

 

 

The problem is that it seems not to recognize those characters for the comparison, and it doesn´t find those strings.

 

 

Do you know if there is any way to introduce those kind of characters in a data group???

 

 

Thank you very much in advance.

 

 

Best regards.

9 Replies

  • Hi Adrian,

     

     

    I couldn't figure out a way to add a carriage return to a datagroup. I'm not sure this is possible. If you don't get any suggestions here, you could open a case with F5 Support.

     

     

    Can you clarify what you're trying to do with a carriage return in the datagroup? HTTP header values shouldn't have a carriage return. Just about any ASCII meta-character should be URL encoded if included in an HTTP header or value.

     

     

    Aaron
  • Hi Aaron,

     

     

    Thank you very much. I opened a case with F5 support, but they told me that they couldn´t help me with this issue.... ;-(

     

     

    What the customer want to do is:

     

     

    - When www.google.com/m?login --> match with the data group and send to a specific pool

     

    - When www.google.com --> sent to another pool

     

     

    The thing is that when we write in the data group www.google.com/m?login, the string is not matched with the data group. It seems not to recognize the caracters / or ?......

     

     

    I thought it should be any way to introduce those characters, but now i am not so sure....

     

     

    Thank you very much.

     

     

    Ciaoo
  • Why couldn't they help with the question? You should be able to use / and ? and other meta-characters as string class elements. I just couldn't figure out how to include a newline or other character.

    Here is a quick test that worked on 10.1:

     
      b class chars_class list 
     class chars_class { 
        { 
           "www.example.com/path/to/file.ext?param=value" 
        } 
     } 
     

     
     when RULE_INIT { 
      
        log local0. "class search1: [class search chars_class contains "file.ext"]" 
        log local0. "class search2: [class search chars_class contains "www.example.com/path/to/file.ext?param=value"]" 
        log local0. "class search3: [class search -element chars_class contains "www.example.com/path/to/file.ext?param=value"]" 
     } 
     

    : class search1: 1

    : class search2: 1

    : class search3: www.example.com/path/to/file.ext?param=value {}

    Aaron
  • Hamish's avatar
    Hamish
    Icon for Cirrocumulus rankCirrocumulus
    Add the data as a base64 encoded string. Then when you've readthe value from the class, simply decode it.

     

     

    H
  • Novel solution. You'd want to also base64 encode the string you're looking up against the class.

     

     

    Aaron
  • spark_86682's avatar
    spark_86682
    Historic F5 Account
    You could also use URI encoding, as it would likely produce a smaller and more readable result if there are only a few characters that need to be encoded.
  • Thank you very much for your answers.

     

     

    Regarding the example above. Sorry for my ignorance. I am using version 9.4.5, and trying to configure a data group. I have seen that you created a class. Is it the same than a data group in version 10, or i could also create a class for trying it in this version???

     

     

    Thank you very much.

     

     

    Best regards
  • Hamish's avatar
    Hamish
    Icon for Cirrocumulus rankCirrocumulus
    Good catch. Data groups are also called classes. It just depends on where you're looking. e.g. The GUI calls them Data Groups. At the CLI they're classes. As they are in iRules (e.g. matchclass, findclass). You'll also find that rate shaping use rate classes... So don't confuse the two there...

     

     

    I'm not sure why they're called two different things... Maybe just different people doing the coding early on? Or the spec and name changed somewhere (Possibly around the v4 -> v9 transition?) (Sorry too long ago for me to check a v4 CLI and too far away to remember)

     

     

    H
  • I think classes were renamed datagroups (around 9.2?) at least in the GUI to distinguish them from HTTP classes. It would be nice to change datagroups back as it just causes more confusion now when looking at the class definition in the bigip.conf or using the findclass/matchclass/class commands against a "datagroup".

     

     

    Aaron