How can I send multiple Set-Cookie headers from API Gateway using a proxied Lambda

后端 未结 5 2030
醉话见心
醉话见心 2021-01-17 09:40

I\'m using API Gateway\'s Proxy integration to call a Lambda. The output format specification is this follow JSON format:

{
  \"statusCode\": httpStatusCode,         


        
5条回答
  •  Happy的楠姐
    2021-01-17 10:15

    Use multiValueHeaders:

    response.multiValueHeaders = {
      "Set-Cookie": [
        'cookie1=value1',
        'cookie1=value1'
      ]
    }
    

    or:

    {
        "statusCode": httpStatusCode,
        "headers": { "headerName": "headerValue", ... },
        "multiValueHeaders": { "headerName": ["headerValue", "headerValue2",...], ... },
        "body": "..."
    }
    

    https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-output-format

提交回复
热议问题