Amazon CloudFront serving compressed files with Origin server running NGINX

0

A customer is serving compressed via Amazon CloudFront by zipping the content on the origin server using NGINX module. They have not enabled the option on the CloudFront distribution to compress objects automatically. Would this option needed to be enabled?

AWS
asked 4 years ago632 views
1 Answer
0
Accepted Answer

They don't need to enable compression on CloudFront if the origin already compresses files, "if your origin returns a compressed file to CloudFront, CloudFront detects that the file is compressed based on the value of the Content-Encoding header and doesn't compress the file again." - https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/ServingCompressedFiles.html

Note that there is a configuration for NGINX origins:

When CloudFront forwards a request to the origin server, it includes a Via header. This causes NGINX to interpret the request as proxied and, by default, NGINX disables compression for proxied requests. If your version of NGINX includes the gzip_proxied setting, change the value to any so that NGINX will return compressed content to CloudFront. For more information, see the NGINX documentation for the module ngx_http_gzip_module.

AWS
answered 4 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions