Forum Discussion
Martin_Kaiser_1
Nimbostratus
Oct 20, 2005using 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
- Martin_Kaiser_1
Nimbostratus
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 - Martin_Kaiser_1
Nimbostratus
Posted By kaiser_m on 10/25/2005 1:34 AMgetfield "/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 - Brian_Gupta_115
Nimbostratus
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 - unRuleY_95363Historic F5 AccountIf the split string is not found, an empty string is returned.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
