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 Antworten
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
beantwortet vor einem Jahr
  • 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
EXPERTE
beantwortet vor einem Jahr
  • 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

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen