Add a
Cache-Control
header to the response
The following example function adds a Cache-Control
HTTP header to the
response. The header uses the max-age
directive to tell web browsers to
cache the response for a maximum of two years (63,072,000 seconds). For more
information, see Cache-Control
This is a viewer response function.
function handler(event) { var response = event.response; var headers = response.headers; // Set the cache-control header headers['cache-control'] = {value: 'public, max-age=63072000;'}; // Return response to viewers return response; }