Forum Discussion
Piotr_Pozna_ski
Nimbostratus
Apr 24, 2015Best way to rewrite uri to pass path segment as part of query string?
Hello.
I need URI's matching pattern /prefix// where is of form [a-z]{1,} to be passed to the internal host as / with id as a part of query string id= .
For example:
/...
Brad_Parker
Cirrus
Apr 24, 2015I haven't tested this yet, but you could try somthing like this.
when HTTP_REQUEST {
if {[string tolower [URI::path [HTTP::path] 2 2]] matches_regex "[a-z]{1,}"}{
HTTP::path "/[URI::path [HTTP::path] 3]"
if {not ([HTTP::query] equals "")}{
HTTP::query "[HTTP::query]&id=[URI::path [HTTP::path] 2 2]"
}
else {
HTTP::query "id=[URI::path [HTTP::path] 2 2]"
}
}
}
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
