Service Callout propagate current request headers without defining them in SC

is there a way to configure Service Callout to just "honor" the incoming headers from the proxy making the call?

we have dynamic situations based on headers and found out that I had to do a lot of if-else

if scenario 1. --> SC with 2 headers.

if scenario 2. ---> SC with 3 headers.

I wish the client just sends 2 or 3 headers and for the proxy developer just to pass through the incoming headers.

is it possible?

0 1 351
1 REPLY 1

Hi @Esteban Lartigue

In your Service Callout policy, just add this

<Copy source="request">
    <Headers/>
</Copy>

It should copy all the headers from the proxy request and send it to the Service Callout request

If you want to specifically just copy 2 or 3 out of the many headers being sent, then you can use something like this

<Copy source="request">
    <Headers>
       <Header name="header1"/>
       <Header name="header2"/>
    </Headers>
</Copy>