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 09, 2014Nacreous
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"
}
}
- Rajesh_A_142089Apr 09, 2014NimbostratusThank you IheartF5! This did the job.
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