How can I pass an arbitrary header field to an upstream system?
Use pair producers to copy the wanted header fields of the incoming request ($request/headers
) to the request
action configuration. Here we pass User-Agent
and Accept
:
<flow>
<request>
{
"url": "http://httpbin.org/get",
"headers": {
{{: $request/headers/user-agent }}
{{: $request/headers/accept }}
}
}
</request>
</flow>
We can reduce this further to
"headers": {
{{: $request/headers/user-agent | $request/headers/accept }}
}
or maybe even more readable using with
:
"headers": {
{{with $request/headers }} {{: user-agent | accept }} {{end}}
}
Last updated
Was this helpful?