Forum Discussion
Silvia_84906
Nimbostratus
May 04, 2010Remove a parameter from a query
Hi all,
I'm trying to remove a parameter from a query and I've tried to do it in so many ways but they didn't work as I expected...
For example the URL could be:
And I'd li...
hoolio
Cirrostratus
May 04, 2010If you want to remove the parameter name and value (if present) from the query string, you could try something like this:
when HTTP_REQUEST {
Check if the query string parameter value isn't null
if {[HTTP::query] contains "X-VODAFONE-3GPDPContext="}{
Use a workaround to parse the parameter value from the query string
described on http://devcentral.f5.com/wiki/default.aspx/iRules/uri__query
set param_value [URI::query "?&[HTTP::query] "&X-VODAFONE-3GPDPContext"]
Save a copy of the URI with the param and value removed
set uri [string map [list "X-VODAFONE-3GPDPContext=$param_value" ""] [HTTP::uri]]
Replace && with & in the updated query string if && is present and set the URI to this
HTTP::uri [string map "&& &" $uri]
Log the cached and updated values for the URI
log local0. "Original URI: [HTTP::uri], updated URI: [string map "&& &" $uri]"
}
}
Aaron
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
