Forum Discussion
Yaniv_99962
May 23, 2017Nimbostratus
remove HTTP header based on its value
Lets say I have a client sending multiple headers with same name but different values.
How can i remove just one of these headers if it's value is equal to something i'm looking for?
For example:
...
Jad_Tabbara__J1
May 23, 2017Cirrostratus
Hello Yaniv,
try this
set nTEST [HTTP::header count "TEST"]
if { $nTEST eq "0" } {
log local0. "Nothing to do => No TEST header found"
} else {
set TESTValueList [HTTP::header values "TEST"]
set firstloop 0
foreach TESTValue $TESTValueList {
if { $firstloop eq "0"} {
HTTP::header remove "TEST"
}
if { $TESTValue eq "c"} {
nothing to do
log local0. "Removed -> TEST: $TESTValue"
} else {
HTTP::header insert TEST $TESTValue
log local0. "Inserted -> TEST: $TESTValue"
}
set firstloop 1
}
}
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