Skip to content

Instantly share code, notes, and snippets.

@matthewberryman
Created October 7, 2017 05:34
Show Gist options
  • Save matthewberryman/8bcca37a5a9f7e0af6c8f3f5db67c81b to your computer and use it in GitHub Desktop.
Save matthewberryman/8bcca37a5a9f7e0af6c8f3f5db67c81b to your computer and use it in GitHub Desktop.
lambda to add cache-control header to cloudfront
exports.handler = (event, context, callback) => {
const response = event.Records[0].cf.response;
const headers = response.headers;
headers['cache-control'] = [
{key: 'Cache-Control',
value: 'max-age=3600'
}];
callback(null, response);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment