Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
'use strict';
module.exports.addCors = async (event, context, callback) => {
const response = event.Records[0].cf.response;
const headers = response.headers;
response.statusCode = 200;
headers['x-serverless-time'] = [{ key: 'x-serverless-time', value: }];
headers['access-control-allow-origin'] = [{ key:'access-control-allow-origin', value: '*' }];
delete headers['cache-control'];
delete headers['location'];
delete headers['expires'];
delete headers['server'];
return callback(null, response);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment