How to set target.header.host in the request header after Apigee decides on load balancing target server?

Based on the load balancer selected target server, we need to set the target.header.host value in the request header.

Example:

<HTTPTargetConnection>

<LoadBalancer>

<Algorithm>RoundRobin</Algorithm>

<Server name="server-1"/>

<Server name="server-2"> <IsFallback>true</IsFallback> </Server>

</LoadBalancer> <Path/>

</HTTPTargetConnection>

After load balancer selects, we want to set the target.header.host as follows:

server-1 --> target.header.host=abc.com

server-2 --> target.header.host=xyz.com

0 1 798
1 REPLY 1

Not applicable

There is one option as pre-target flow hook. Just add the shared flow in the pre-target flow hook in which you will put one assign message policy to set the header. And remember to put the policies condition as the apiproxy.name as the proxy for which you want that condition.

The second option is to use javascript and try.