API Gateway drops the headers rather than passing it to the lambda.

0

I have an HTTP API with HTTP_Proxy forwarding request to the lambda. When I checked lambda logs the below is my observation: When I send api header like

HeaderAction
APIGW-ClientApppasses to lambda
apigw-clientappdoesn't pass to lambda
apigw_clientapppasses to lambda
test-testpasses to lambda

What is wrong with apigw-clientapp why can't api gateway forward it to lambda

2 Answers
1

Header names are converted to lower case, so apigw-clientapp and APIGW-ClientApp appear to be the same header when they are both present, then based on order the last one wins and is passed through. This is the case for a header set with both apigw-clientapp and APIGW-ClientApp which isn't a real world example.

From my testing any lower case header starting with apigw- will not get passed.

The list of API Gateway Reserved Headers contains this header name: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-parameter-mapping.html#http-api-mapping-reserved-headers

I recommend selecting a different header name.

profile picture
answered a year ago
  • Even if I send apigw-clientapp header alone to api gateway(HTTP_API with HTTP_PROXY), it doesn't pass to lambda.

0

Hi, this article will help in customizing the headers that you need to pass to your Lambda: https://repost.aws/knowledge-center/custom-headers-api-gateway-lambda

It goes quite far in all details to configure properly.

profile pictureAWS
EXPERT
answered a year ago
  • The link you have provided is for REST API. I want to achieve the same in HTTP API and there is problem in forwarding this apigw-clientapp header

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions