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 remove the mykey=myvalue from the uri in the HTTP_REQUEST event -such that the url is /myuri or /myuri?otherkey=othervalue
Please advise.
Thanks Rajesh
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" } }