Lambda@Edge for "origin request" doesn't receive custom headers

0

I have a CloudFront distribution with S3 origins. In the origin settings there are custom headers added (i.e. "x-test"). The behaviour has two Lambdas: for "origin request" and "origin response" hooks (both NodeJS). It is all completely fine with the one for "origin response" hook, but the one for "origin request" doesn't receive "x-test" header in the event...headers object. All the docs and articles I've read say that "origin request" Lambda should get this header too. Tried to add "x-test" header to whitelist in attached "origin request policy" - this didn't help. Cannot find ANY information why could this happen. Does anyone have any ideas?

  • Can you share from which object are you trying to read the custom header from?

  • Sure. event.Records[0].cf.request.headers The same works perfectly for the function for "origin response"

Corwin
질문됨 일 년 전931회 조회
1개 답변
0
수락된 답변

I have finally found them. For "origin request" hook they are here: event.Records[0].cf.request.origin.s3.customHeaders and if origin is ALB: event.Records[0].cf.request.origin.custom.customHeaders

Corwin
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠