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

Is the Host header blocked on the Apigee outbound requests ?

I am trying to set a Header - "Host" with a standard value hardcoded using Assign Message Policy. I see this particular header available on the final list of Request Headers sent to the backend (via the Apigee trace). But when I open the curl (using SHOW CURL option on the trace), I don't see this particular header listed. Even the backend system complained stating that the Host header was missing. 

Additionally when I tried it with "Hosts" instead of "Host", things are working as expected.

So the question is - Is there any restriction in Apigee that we cannot send out Host header on the backend request ?

Solved Solved
0 4 103
1 ACCEPTED SOLUTION

This is most likely due to how Apigee sets the host header from the TargetEndpoint configuration, either via a TargetServer, URL or templated URL.

You can use an Assign Message to set the special and currently undocumented `target.header.host` in the Target flow using:

<AssignMessage name="AM-set-target-host-us-west1">
  <AssignVariable>
    <Name>target.header.host</Name>
    <Value>xapi-dev-apigeex-payg-kurt-us-west1.demo.net</Value>
  </AssignVariable>
</AssignMessage>

Note that it must be sent in the Target flow. 

View solution in original post

4 REPLIES 4