Flush content from Amazon CloudFront CDN
Senast uppdaterad den May 02, 2021 07:16:28 PM GMT
How do we invalidate the cache in AWS CloudFront CDN when publishing content?
There is nothing out-of-the-box in AEM that does this. However, a custom solution could be developed:
- Implement a custom replication agent. See the steps here.
- To do the actual cache invalidation in the TransportHandler code, use the CloudFront API POST invalidation as documented here.
Alternatively, instead of creating a flush agent, the best practice is simply to leverage the "Cache-Control: max-age=..." header to control the TTL of files in the CloudFront CDN. This works instead of implementing a replication agent to invalidate the CloudFront cache. See this documentation.