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

Hi

So something like…

when HTTP_REQUEST {
  if { [HTTP::header "Accept"] contains "application/json" }  {
  HTTP::header insert "New-Header" "New-Header-Value"
	}
}

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

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
}
}
}
}