Jul 26, 2017 · 1 min read
It looks like the format of the response object changed from the initial preview. Now response.header is not a simple key/value object, but each item is a list of key/value pairs. I had to use the following to get custom headers added:
headers[‘strict-transport-security’] = [ { key: ‘Strict-Transport-Security’, value: “max-age=86400; includeSubdomains” } ];
You can see this format in their example functions at https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-examples.html .
I think this is slightly bonkers of them, but there you go.
