- Newest
- Most votes
- Most comments
Hi,
the right way to proceed is to NOT compress yourself at origing but configure CloudFront to compress at edge for the types of files for which compression is interesting.
See https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/ServingCompressedFiles.html
This way, when you hit a file from index.html, you will click the link corresponding to uncompressed version but Cloudfront will compress it at edge (if there is not already a compressed version in cache) and serve the compressed version (which will be automatically decompressed by the receiving browser if configured to do so),
Best,
Didier
According to the documentation here, I think you do want to enable compression. https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/ServingCompressedFiles.html
"If the origin returns a compressed object, as indicated by the presence of a Content-Encoding header in the HTTP response, CloudFront sends the compressed object to the viewer, adds it to the cache, and skips the remaining step. CloudFront doesn’t compress the object again."
Hope this helps!
answered 2 years ago
Relevant content
asked a year ago
- AWS OFFICIALUpdated 7 months ago

Thank Didier, I did that now works.
Hi Vanals, glad that your issue is now fixed! Thanks for accepting my answer