Skip to content

Lambda-http: setting multiple cookies using multiValueHeaders is not supported in API Gateway version 2.0 #267

Closed
@l3ku

Description

@l3ku

From https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html:

Format 2.0 doesn't have multiValueHeaders or multiValueQueryStringParameters fields. Duplicate headers are combined with commas and included in the headers field. Duplicate query strings are combined with commas and included in the queryStringParameters field.

Format 2.0 includes a new cookies field. All cookie headers in the request are combined with commas and added to the cookies field. In the response to the client, each cookie becomes a set-cookie header.

I have a use case, where I need to pass several set-cookie headers in the response from Lambda to API Gateway 2.0 using the lambda-http crate. However, when I set multiple SET_COOKIE headers on the response, only one of them is returned from API Gateway, presumably since API Gateway only handles the one header which is present in the headers field of LambdaResponse.

Is there a way to work around this other than adding the cookies field as part of the LambdaResponse in some manner, like using a similar enum as LambdaRequest for different API Gateway versions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions