Announcements
This site is in read only until July 22 as we migrate to a new platform; refer to this community post for more details.
Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Setting a southbound (targetRequest) header

I need to set an http header on the target (southbound) request.

Is there a callback event when the target request is about to occur?

I've been able to add the headers to the request, but this seems a little indirect.

Solved Solved
0 4 468
1 ACCEPTED SOLUTION

Former Community Member
Not applicable

The only callbacks are in the documentation here.

To set the target dynamically, you can use the following variables:

req.targetHostname = xx;                
req.targetPort = xx;        
req.targetPath = xx;

View solution in original post

4 REPLIES 4

You can attach an Assign Message Policy on the Target Pre Flow to add an HTTP Header. The policy snippet would appear as follows:

<Add>        
 <Headers>            
   <Header name="static-header">static value</Header>
   <Header name="dynamic-header">{request.user.agent}</Header>       
 </Headers>
</Add>

The Value of the header can be fixed or dynamic (acquired from KVM, original request context) based on your use case.

Thanks @rmishra, but i was looking for a microgateway solution. I perhaps should have been clearer about that, other than posting this in the microgateway section.


I am going to pay more attention to tags/labels of a question going forward 🙂

Definitely missed the boat on that one

Former Community Member
Not applicable

The only callbacks are in the documentation here.

To set the target dynamically, you can use the following variables:

req.targetHostname = xx;                
req.targetPort = xx;        
req.targetPath = xx;