Host header proxy behavior? "X-Forwarded-*" and "Forwarded"


We have recently put an AWS API gateway (the new “HTTP API” kind, not “REST API”) in front of our Aptible endpoint.


  • Is this supported/expected to work?
  • How does the Aptible proxy behave when it comes to the X-Forwarded-* headers and the Host header? Will the Aptible proxy overwrite X-Forwarded-* headers that the AWS API gw sets?
  • Apparently AWS GW “HTTP APIs” also set the newer, standardized Forwarded header. (Not sure if it sets both the older X-Forwarded-* + newer Forwarded or just the newer Forwarded header actually.) Do you know how the Aptible proxy will treat the Forwarded header?


This is the headers of the request we receive in the Aptible container:

Aptible endpoint:

HTTP(S) Endpoints only set two X-Forwarded-* request headers: X-Forwarded-For and X-Forwarded-Proto as described here. Additionally, the Endpoint’s AWS ALB sets the X-Forwarded-Port header which the Endpoint passes through.

Most other headers, including Host and Forwarded, are passed through with the request as-is so whatever the API gateway sets for these headers is what the application will receive. I recommend sending a request directly to the Endpoint and to the API gateway and comparing the two in order to see how they differ.

I don’t see any reason why this setup wouldn’t work. Are you running into issues?

Thank you Josh! That’s helpful.

If anyone else is wondering, I tested by sending a request to AWS API gateway using and these are the headers:

So it does not set X-Forwarded-* headers, only Forwarded.

Are you running into issues?

A little bit. The host part of the request we receive is not what we expected. But it looks now like it’s mostly an issue with how AWS API gw works. As you can see in the screenshot above, AWS modifies the Host header to the integration URL which is not what we want.

But I think we will be able to work around it now that we know how Aptible and AWS works.

That was not 100% accurate apparently. Adding ?show_env=1 to the request shows all AWS API gateway headers: