Created
October 7, 2017 05:34
-
-
Save matthewberryman/8bcca37a5a9f7e0af6c8f3f5db67c81b to your computer and use it in GitHub Desktop.
lambda to add cache-control header to cloudfront
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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