Forum Discussion
MAbbas
Mar 21, 2022Cirrus
insert HTTP Header after
Hi All i want to insert a header a certain header in my scenario - i want to insert a custom header after - accept: application/json can can someone guide - Thanks
MAbbas
Cirrus
thanks for the reply - it does insert a header - but not right after - but as the last header
i am trying tackel - Expect: 100-continue -- if i can insert it on F5 instead of client sending it through
iaine
Mar 22, 2022Nacreous
Gotcha, how about something like...
when HTTP_REQUEST {
if {[HTTP::header "Accept"] contains "application/json"}{
foreach aHeader [HTTP::header names] {
set hValue [HTTP::header value $aHeader]
if {$aHeader == "Accept"}{
HTTP::header remove $aHeader
HTTP::header insert $aHeader $hValue
HTTP::header insert "New-Header" "New-Header-Value"
} else {
HTTP::header remove $aHeader
HTTP::header insert $aHeader $hValue
}
}
}
}
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