For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Martin_Kaiser_1's avatar
Martin_Kaiser_1
Icon for Nimbostratus rankNimbostratus
Oct 20, 2005

using getfield to split up URIs

Hi there,

 

 

can anyone of you show me the correct syntax for using the function getfield in an iRule?

 

What I want to do is split up an URI like "/webstart/portal/customer_id/some/more/fields" and extract the field customer_id, that is always in the third position. The value should be stored in a variable that can be used again later for dynamically choosing pools or redirects in case of LB_FAILED.

 

 

Thanks in advance!

 

Regards,

 

Martin

14 Replies

  • Hi,

    I've got two more questions:

    1. will getfield return the whole string if the field delimiter does not exist and the field to return is number one? E.g.:

    getfield "/some/path/to/ressource/" "?" 5

    Will this return "ressource" ?

    2. How exactly does URI:query work? The manual only states "extracts the query part from the URI". I'm not really a webhosting person, but more of a networks guy, so "query part" does not really tell me that much at all...

    Thanks and regards,

    Martin
  • Posted By kaiser_m on 10/25/2005 1:34 AM

    getfield "/some/path/to/ressource/" "?" 5

    That was bullshit, of course. Sorry, but it's still in the morning...

    What I really meant was that:

    getfield [getfield "/some/path/to/ressource/" "/" 5] "?" 1

  • Query part is everthing to the right of the question mark in a URL/URI. (Look at you browser address bar right now.)

     

     

    For the following URI:

     

    http://devcentral.f5.com/Default.aspx?tabid=28&view=post&forumid=5&postid=4984&replyid=5050

     

     

    tabid=28&view=post&forumid=5&postid=4984&replyid=5050 is the query part.

     

     

    -Brian