I’m trying to duplicate an existing lambda function into a serverless app. I already got most of it right, but there is a configuration I can’t make.
I want to pass the X-Forwaded-For
to the lambda function. I also have a request body template configured.
This is the function part on the serverless.yml:
functions:
enpoint:
memorySize: 128
handler: handler.handler
events:
- http:
method: POST
path: reviews
integration: lambda
request:
parameters:
headers:
'X-Forwarded-For': true
passThrough: WHEN_NO_TEMPLATES
template:
application/json: '${file(json_mapping_template.txt)}'
cors:
origins:
- '*'
headers:
- Content-Type
- X-Amz-Date
- Authorization
- X-Api-Key
- X-Amz-Security-Token
There was an issue with a similar problem: #466
I looked into the .serverless/cloudformation-template-update-stack.json
file and saw no reference to these settings.
On the AWS console, this setting is on the API Gateway, after selecting the POST method, Method Execution panel, HTTP Request Headers.
What am I doing wrong? If the question needs more info, let me know.