[SOLVED] Understanding gzip compression for static content


We created a website & checked the performance on https://gtmetrix.com/

There are suggestions that we should have GZIP enabled on the Server(which we did) but not able to understand how does it actually work

Scenario: We have js & CSS on S3 Bucket. Do we need to have to compress them how can we make them gzip compression, is there any tool available. If that can be done then how we can change content-encoding: gzip?

If We can enable gzip on our server then we should be calling the API from our Server first then from the Server we need to call the S3 URL & get its content along we can add compression or max-age in the header. Is this the best approach?

OR while calling a request we should use some networking library and add the required header for gzip compression

Please suggest how we should load the static content we need to use on our website.

See this answer in SO: GZIP Compression on static Amazon S3 files

Thanks. it works.

Can we add efficient cache policy also? Is there any way?

Yep, with AWS Cloudfront, see here: Managing how long content stays in the cache (expiration) - Amazon CloudFront

1 Like

Thanks, it really helps!