Recently, I read a question about a Logic App that received an HTTP request.  The purpose of the Logic App was to add some extra HTTP headers to the request, while retaining the orignal ones, before forwarding the message to another HTTP endpoint. This short blog demonstrates how you can enrich HTTP headers, without losing the orignal HTTP headers.

The solution

Our Logic App consists of three actions:

Enrich HTTP Headers - 1

The first shape is an Request trigger that receives the original request.  Default configuration.

The second one is an Initialize Variable that constructs the new HTTP Headers object.

Enrich HTTP Headers - 2

The third action forwards the original request to a RequestBin endpoint.  Notice that the Headers parameter accepts both key-value pairs or JSON objects.  I use the following expression to merge the new with the orignal HTTP headers:

@union(triggerOutputs().Headers, variables('NewHeaders'))

Enrich HTTP Headers - 3

Edit: I received the question if this can be done without an intermediate Initialize Variable action.  Yes, it’s possible.  A little cheaper, but a little less readible:

 union(triggerOutputs().Headers, json('{  "x-new-header-3": "header-3",  "x-new-header-4": "header-4"}'))


Let’s send an HTTP request to the Logic App, with 2 original HTTP headers.

Enrich HTTP Headers - 4

If we now inspect the received request in RequestBin, we see that the two new HTTP headers are appended to the original ones.  Additionally, some default Logic Apps HTTP headers are added to the request too.

Enrich HTTP Headers - 5.PNG


By using the @union workflow function, we are able to easily append additional values to the incoming HTTP headers.

Hope this was a useful one!



Your Azure Coach is specialized in organizing Azure trainings that are infused with real-life experience. All our coaches are active consultants, who are very passionate and who love to share their Azure expertise with you.