Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Apigee - Targetendpoints & TargetServers

When Target Servers are pure IP address (which would be the IP address of the target lb); what must be done to have apigee properly set the host header to the targetserver to be the request.header.host and NOT the IP Address? (and even if I use a DNS entry; I'd want the host to be the request.header.host and not the target.header.host) 

Solved Solved
0 13 741
1 ACCEPTED SOLUTION

The AM policy

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage continueOnError="false" enabled="true" name="AM-host">
    <DisplayName>AM-host</DisplayName>
    <Properties/>
    <AssignVariable>
        <Name>target.header.host</Name>
        <Ref>request.header.host</Ref>
    </AssignVariable>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
    <AssignTo createNew="false" transport="http" type="request"/>
</AssignMessage>

The target flow XML

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<TargetEndpoint name="default">
    <PreFlow name="PreFlow">
        <Request>
            <Step>
                <Name>AM-host</Name>
            </Step>
        </Request>
        <Response/>
    </PreFlow>
    <Flows/>
    <PostFlow name="PostFlow">
        <Request/>
        <Response/>
    </PostFlow>
    <HTTPTargetConnection>
        <URL>https://httpbin.org</URL>
    </HTTPTargetConnection>
</TargetEndpoint>

View solution in original post

13 REPLIES 13