3 Answers
- Newest
- Most votes
- Most comments
0
Use multiValueHeaders instead of headers..
const response = {
statusCode: 200,
multiValueHeaders : {"Set-Cookie": [`language=${language}`, `theme=${theme}`]},
body: JSON.stringify('User profile set successfully')
};
answered 2 years ago
This approach isn't working for me. It's the correct approach in API Gateway, but the
multiValueHeaders
key seems to be ignored on Lambda Function URLs.
0
So multivalueValueHeaders doesnt work as per format 2.0:
Which points you to use "cookies" field:
Which also doesn't work which leaves us with "case iteration":
# python 3
response = {
"statusCode": 200,
"headers": {
"Set-cookie": "cookie1=1",
"SEt-cookie": "cookie2=2",
"SET-cookie": "cookie2=2"
}
}
Or library that maybe accomplishes above:
answered 2 years ago
0
As per the 2.0 format, you can you the cookies attribute:
{
"statusCode": 200,
"body": "<html><div><b>V2</b></div></html>",
"headers": {
"Content-Type": "text/html"
},
"cookies": [
"CloudFront-Key-Pair-Id=foo; Path=/",
"CloudFront-Policy=foo; Path=/",
"CloudFront-Signature=foo; Path=/"
]
}
answered a year ago
Relevant content
- asked 2 years ago
- asked 7 months ago
- asked 2 months ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated a year ago
Did you ever figure out a way to send multiple cookies with Set-Cookie in a Lambda function (without the API Gateway)?