Forum Discussion
C_D_18583
Nimbostratus
May 07, 2008How to modify the PATH of the URI
How do I modify the path of the URI ?
(EG)
from: domainname/path/to/my/service
to domainname/myservice
I want to be able to strip /path/to/my but the number of "/'s" is not known or fixed.
Thanks in Advance
4 Replies
- hoolio
Cirrostratus
You can use HTTP::path (Click here) to retrieve or set the path. The host and query string, if present, aren't modified. - Colin_Walker_12Historic F5 AccountIf you're looking to take whatever URI comes in, assuming it has a certain service name on the end, and update the URI with the one above, you'd want something like:
when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri] { "*service" { HTTP::uri "/myservice" } } }
- C_D_18583
Nimbostratus
Yes . I am looking to take the URI that comes in and strip the path to the service name . I do have a number of service names . Would I have to add each one of these names to the rule ? - Colin_Walker_12Historic F5 AccountYes, if you want to check to see if it's one of, say, 10 different URIs and change them accordingly, then you're going to have to add multiple switch cases to check for those. You could also use the matchclass command, if it's easier for you to modify a class in the long run, but that depends largely on how often you'll be modifying these once the rule is in place.
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