Forum Discussion

CraigM_17826's avatar
CraigM_17826
Icon for Altocumulus rankAltocumulus
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