Forum Discussion
Cambo_146377
Nimbostratus
Mar 05, 2014Re-write request to new endpoint and modify query string params
Apologies (to Kevin Stewart) - this is a re-post as I had to delete the first one as I couldn't edit it properly - the editor seems to be buggy. This is a slight revision of my original question. ...
Kevin_Stewart
Employee
Mar 05, 2014This might be one way to do it:
when HTTP_REQUEST {
if { ( [HTTP::path] equals "/" ) and ( [HTTP::query] ne "" ) } {
HTTP::uri "/[URI::query [HTTP::uri] param1]/NewEndpoint?param2=[URI::query [HTTP::uri] param2]"
}
}
The above is dependent on the named params (param1 and param2). If the values can be different and/or you just need to move the first param, another option would be to split the query string into a list.
when HTTP_REQUEST {
if { ( [HTTP::path] equals "/" ) and ( [HTTP::query] ne "" ) } {
set query [split [HTTP::query] "&"]
HTTP::uri "/[lindex [split [lindex $query 0] "="] 1]/NewEndpoint?[lindex $query 1]"
}
}
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