F5 is upgrading its customer support chat feature on My.F5.com. Chat support will be unavailable from 6am-10am PST on 1/20/26. Refer to K000159584 for details.

Forum Discussion

Rajesh_A_142089's avatar
Rajesh_A_142089
Icon for Nimbostratus rankNimbostratus
Apr 08, 2014
Solved

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...
  • IheartF5_45022's avatar
    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"
            }
        }