Serving custom headers from static sites on CloudFront/S3 with Lambda@Edge
Tom Cook
858

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.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.