How to access HTTP headers for request to AWS API Gateway using Lambda?

前端 未结 7 2004
终归单人心
终归单人心 2020-11-28 23:38

I see in the API Gateway FAQ that it is possible to access the request headers sent to the API Gateway...

If you already utilize OAuth tokens or any o

7条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-29 00:30

    As per Prabhat's answer setting up with the lambda proxy integration request is the simplest way to do this, after which you can access the request headers, path parameters and query parameters via

    event['pathParameters']['param1']
    event["queryStringParameters"]['queryparam1']
    event['requestContext']['identity']['userAgent']
    event['requestContext']['identity']['sourceIP']
    

提交回复
热议问题