Forum Discussion

CraigM_17826's avatar
CraigM_17826
Icon for Altostratus rankAltostratus
Jan 06, 2012

parsing a datagroup/class

Hi all,

 

 

I have this situation. Our iRule for our main website now has a lot of redirects which are based on the URI specified. There are now getting to be quite a few of these and for various reasons I won't go into it is getting to be a bit of a pain to maintain these in iRules. I briefy looked at using HTTP Classes and although they addressed some of my issues, for some reason I could not get case insensative matches to work reliably. What I am now thinking of doing is using a datagroup/class where the string name will be the URI to match on and the value will be the URI to redirect to.

 

 

eg.

 

 

StringName Value

 

/contactus /public/contact-us

 

/help /public/help

 

So the iRule logic would be something like

 

 

if the uri equals the value of the first element redirect to 2nd element

 

 

Obviously, it would need to repeat this until it exhausts all of the entries in the datagroup.

 

 

I feel this will be a much simpler way to manage these redirects. So, can anyone give me any pointers on how I would go about coding this in a iRule? I'm currently going over the class statement and I'll see if I can nut it out for myself, but I am not adverse to any pointers :)

 

 

tia

 

 

Craig

 

 

13 Replies

  • Hi Aarron,

     

     

    I'm glad you said that because of all of the ways I have tried to do this hacve failed misserably and my ego was taking a hit :) I think I'll just enforce the use of lowercase characters in the datagroup and if someone doesn't follow the spec then they have themselves to blame.

     

     

    Thanks everyone for thier help with this. Much appreciated.

     

     

    Craig

     

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    Aaron's spot on, Craig, there isn't a simple way to force a data group to be case insensitive when matching items at the moment. We haven't seen much need for this as users are generally content to keep their data group a single case and force the comparisons to be coerced to that case as well. If there is a specific use case that you have and would like to let us know about, we can certainly look into this.

     

     

    Otherwise, it sounds like you're on the right path. ;)

     

     

    Colin
    • jmh's avatar
      jmh
      Icon for Nimbostratus rankNimbostratus
      It would be nice to simply copy/paste redirect URLs into the datagroup and not have to worry about what case they were submitted in before adding them. Since some web servers care about case sensitivity it would be nice to leave the data as was intended but provide the class command with the ability to ignore case.