CloudFront with S3 website as origin is not serving gzipped files

前端 未结 2 1976
野的像风
野的像风 2020-12-14 07:14

AWS now supports gzipping files through CloudFront

I\'ve followed along with all of the instructions in Serving Compressed Files, and yet gzipping is not working.

2条回答
  •  情话喂你
    2020-12-14 07:41

    I hit the same error today and solved it by adding a CORS rule to the S3 bucket. This rule ensures the Content-Length header is sent to Cloudfront so content can be gzipped:

    S3 > Bucket > Permissions > CORS Configuration

    
    
        
            *
            GET
            3000
            Authorization
            Content-Length
        
    
    

    Credit goes to Robert Ellison: http://ithoughthecamewithyou.com/post/enable-gzip-compression-for-amazon-s3-hosted-website-in-cloudfront

    As far I know, this seems to be an undocumented requirement.

提交回复
热议问题