Forum Discussion
SSHSSH_97332
Nimbostratus
Aug 08, 2014HTTP URI Parts
http://www.example.com:8080/main/abc/index.jsp?user=test&login=check
In the above , if i want to print second part of URI , which is here "abc" , is this [ [HTTP::uri] 2] or What ?
4 Replies
Hello,
You can use this line of codes within irule :
set uri [HTTP::uri] set stripped_uri [getfield $uri "/" 3]BR
Yann
- SSHSSH_97332
Nimbostratus
Thx Why we used "3" i wa sexpecting "2" , as first part of uri is "/main" , so second part is "/abc"
As far as I remember, when using getfield with "/" delimiter, your url is cut as follow : /main/abc/index.jsp?user=test&login=check
1 "" <- this is a null string value before the first "/" 2 main 3 abc 4 index.jsp?user=test&login=check- nitass
Employee
Yann is absolutely right.
config [root@B6900-R69-S40:Active:Standalone] config tmsh list ltm rule qux ltm rule qux { when RULE_INIT { for { set i 1 } { $i < 10 } { incr i } { log local0. "\[getfield /main/abc/index.jsp?user=test&login=check / $i\] = [getfield /main/abc/index.jsp?user=test&login=check / $i]" } } } /var/log/ltm [root@B6900-R69-S40:Active:Standalone] config tail -f /var/log/ltm Aug 10 06:47:01 B6900-R69-S40 info tmm[15765]: Rule /Common/qux : [getfield /main/abc/index.jsp?user=test&login=check / 1] = Aug 10 06:47:01 B6900-R69-S40 info tmm[15765]: Rule /Common/qux : [getfield /main/abc/index.jsp?user=test&login=check / 2] = main Aug 10 06:47:01 B6900-R69-S40 info tmm[15765]: Rule /Common/qux : [getfield /main/abc/index.jsp?user=test&login=check / 3] = abc Aug 10 06:47:01 B6900-R69-S40 info tmm[15765]: Rule /Common/qux : [getfield /main/abc/index.jsp?user=test&login=check / 4] = index.jsp?user=test&login=check Aug 10 06:47:01 B6900-R69-S40 info tmm[15765]: Rule /Common/qux : [getfield /main/abc/index.jsp?user=test&login=check / 5] = Aug 10 06:47:01 B6900-R69-S40 info tmm[15765]: Rule /Common/qux : [getfield /main/abc/index.jsp?user=test&login=check / 6] = Aug 10 06:47:01 B6900-R69-S40 info tmm[15765]: Rule /Common/qux : [getfield /main/abc/index.jsp?user=test&login=check / 7] = Aug 10 06:47:01 B6900-R69-S40 info tmm[15765]: Rule /Common/qux : [getfield /main/abc/index.jsp?user=test&login=check / 8] = Aug 10 06:47:01 B6900-R69-S40 info tmm[15765]: Rule /Common/qux : [getfield /main/abc/index.jsp?user=test&login=check / 9] =
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