Forum Discussion
Rajesh_A_142089
Apr 08, 2014Nimbostratus
Remove part of querystring
I want to remove specific key=value pair from the querystring if present
-If my uri is /myuri?mykey=myvalue or /myuri?otherkey=othervalue&mykey=myvalue -I want to rewrite the uri such that I rem...
- Apr 09, 2014
Just one approach;-
when HTTP_REQUEST { if {[URI::query [HTTP::uri]] contains "mykey="} { set newq "" foreach param [split [URI::query [HTTP::uri]] "&"] { if {!($param starts_with "mykey=")} { Build up new query parameter string append newq $param } Add new query portion to path HTTP::uri "[HTTP::path]$newq" } }
IheartF5_45022
Apr 10, 2014Nacreous
I actually made a little mistake - I forgot to add in the ? if there is still a query string remaining it should say
if {$newq ne ""} {
HTTP::uri "[HTTP::path]?$newq"
} else {
HTTP::uri [HTTP::path]
}
- Rajesh_A_142089Apr 22, 2014NimbostratusThank you again IheartF5!
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