Amazon Web Services (AWS) CloudFront Setup for hlx.live
NOTE: The instructions linked on this page apply to the previous version of Edge Delivery Services and are provided for customers who have not upgraded to aem.live yet. The current version of this document is provided here.
The following screenshots illustrate how to configure AWS CloudFront to deliver content from an AEM origin. Essential settings are marked with a red circle.
Create a CloudFront distribution
Configure the origin
If you have successfully configured push invalidation for your project you should also add the following custom header:
Cache behavior
Create cache policy
Create origin request policy
Create Function to remove Age and X-Robots-Tag headers
Go to Functions and click on “Create Function”:
Enter a name for the function (e.g. stripHeaders
), an optional description and click on “Create Function”:
Replace the code of the function with the following snippet and click on “Save changes”:
function handler(event) {
const response = event.response;
const request = event.request;
const headers = response.headers;
// Strip age header
delete headers['age'];
// Check if the request URL does not end with '.plain.html'
if (!request.uri.endsWith('.plain.html')) {
delete headers['x-robots-tag'];
}
return response;
}
Click on “Publish function”:
Finally, associate the function with your distribution:
That’s all (more or less). Please test the distribution in a stage environment.
Previous