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

How to resolve 400-bad request Problem while Retaining host header from inbound request ?

Not applicable

I have already referred to thread : https://community.apigee.com/questions/3829/how-can-we-retain-host-header-from-inbound-request.html

Issue :

My client apps are trying to connect to host (e.g. api.xyz.com) in my Inbound request, but this header gets overriden by Apigee and resolves to the specified target server (e.g. targetserver-xyz.com– our reverse proxy) Since we have reverse proxy sitting in front of our backend, our api backend thinks that request host is targetserver-xyz.com while it was actually api.xyz.com). Due to this, our hateoas links are messed up.

Solved Solved
0 4 4,422
1 ACCEPTED SOLUTION

I think the right way to handle this is by using 'X-Forwarded-Host' header. You can set this header before apigee calls the backend,

So, apigee would call your backend like this,

GET /abc

Host: targetserver-xyz.com

X-Forwarded-Host: api.xyz.com

Your apibackend should take the X-Forwarded-host for constructing the hateoas response links

------

Alternatively, the community post should also work, i think your reverse proxy might be doing 'host' validation [or blocking] that is not allowing this host name 'api.xyz.com'

Whats your reverse proxy? can you check the host configuration? or pls post the error response you are getting in your HTTP 400

View solution in original post

4 REPLIES 4