Forum Discussion
Perween_Zaman_7
Nimbostratus
Nov 06, 2005Question on getfield
Hi
If my URL is http://myDomain.com/myImage.img
what will be the value of the variable second_field in this iRule?
set second_field [getfield [HTTP::uri] "/" 2]
Will it be myImage.img or will it be an empty string because the second slash is missing?
Thanks,
pzaman
2 Replies
- The value will be myImage.img. Here's the reason why. getfield works like this:
{field1}{sep}{field2}{sep}{field3}{sep}...
For your URI of
/myImage.img
If you use a slash ("/") as a separator, then the first token will be before the separator and the second will be after. So the field number "1" would be what's before the slash (an empty string) and the field number "2" would be after the first slash (myImage.img).
-Joe - woshioven
Altostratus
In condition 1 [HTTP::uri] "/" 1] return (null)
In condition 2 [HTTP::uri] "/" 2] return myImage.img
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
