Forum Discussion

Puli's avatar
Puli
Icon for Nimbostratus rankNimbostratus
Jul 27, 2010

Traversing the URL and matching it with a datagroup

Hi All,

 

i have a requirement and wondering if you can help me out.

 

 

Lets say we have a url:

 

www.abc.com/aa/bb/cc/dd/ee

 

and my datagroup has entries for re-directs

 

aa zz

 

bb yy

 

cc xx

 

dd pp

 

 

I need to parse the URL and match each folder.

 

For example.

 

take /aa/bb/cc/dd/ee match it with datagroup , if i find a match then re-direct to target

 

if it does'nt match, strip the last folder from path and match

 

/aa/bb/cc/dd and match it with datagroup.

 

I need to go this way till a maximum of 10 loops or exist if i find a match.

 

 

I trying to understand whats the best way to handle this requirement without causing major impact to performance.

 

For a site with 100 hits /sec, i know our bigIP is a beefy machine and can handle but wanted to get some ideas and code snippets that are optimal.

 

 

thanks.

 

Puli.

 

1 Reply

  • Hi Puli,

     

     

    Conceptually this could be done using various string functions (most likely URI::path or possibly split and/or scan) and the class command to check the datagroup. However, I'd be concerned about the possible resource utilization and latency added by doing recursive operations.

     

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/class

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/uri__path

     

    http://www.tcl.tk/man/tcl8.4/TclCmd/split.htm

     

    http://www.tcl.tk/man/tcl8.4/TclCmd/scan.htm

     

     

    You might try building a simple test rule and do some performance testing of it under load while using timing to record the results:

     

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/timing

     

     

    Aaron