Forum Discussion
Stuart_Feathers
Nimbostratus
Apr 29, 2013URI Matching when URI contains a space
I am using version 11.2 and in the name of full disclosure, I am an iRules noobie.
I am trying to match a specific URI but the URI has a space in the name "common files". When I use the code below it does not match requests that I would expect it to.
([string tolower [HTTP::uri]] starts_with "/common files")
What is the proper way to reference a space in a URI? Would I need to use %20 in the URI? Something like this --
([string tolower [HTTP::uri]] starts_with "/common%20files")
Thank you!
4 Replies
- What_Lies_Bene1
Cirrostratus
I'd imagine it would indeed be %20. You could modify the iRule to have this decoded or simply add the %20. It might be worth adding 'log local0. "URI is [HTTP::uri]" just to check. Anyway, to do the decoding, try this;[URI:decode [string tolower [HTTP::uri]]] starts_with "/common files" - Stuart_Feathers
Nimbostratus
Great, thank you!
- What_Lies_Bene1
Cirrostratus
You're welcome. Have you actually tried it? - nitass
Employee
e.g.[root@ve11a:Active:Changes Pending] config tmsh list ltm rule myrule ltm rule myrule { when HTTP_REQUEST { log local0. "\[HTTP::uri\] [HTTP::uri]" log local0. "\[string tolower [HTTP::uri]\] [string tolower [HTTP::uri]]" log local0. "\[URI::decode [string tolower [HTTP::uri]]\] [URI::decode [string tolower [HTTP::uri]]]" } } [root@ve11a:Active:Changes Pending] config cat /var/log/ltm Apr 30 11:08:11 ve11a info tmm[8163]: Rule /Common/myrule : [HTTP::uri] /common%20files Apr 30 11:08:11 ve11a info tmm[8163]: Rule /Common/myrule : [string tolower /common%20files] /common%20files Apr 30 11:08:11 ve11a info tmm[8163]: Rule /Common/myrule : [URI::decode /common%20files] /common files
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