Gzip compression not used in all files.

0

Hello there,
today we noticed that some files(not all) are not gzip'ed although the client request the gzip version.

Here are two examples, one that is gziped and the other that is not. Both of these files are on the same bucket, from the same origin, with the same properties.

Gziped: https://js.chatservice.co/v0/tracker.js
NOT gziped: https://js.chatservice.co/v0/click-chat.js

Cloudfront has Compress Objects Automatically to Yes.
We are not really sure what to check next to be able to serve all files gziped.

Any help would be greatly appreciated.

Best,
Thanos

Edited by: ThanosDi on Jul 17, 2019 12:27 AM

已提問 5 年前檢視次數 257 次
3 個答案
0
已接受的答案

There you go!

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/ServingCompressedFiles.html
"CloudFront determines whether the file is compressible: ... The file size must be between 1,000 and 10,000,000 bytes."

Also, depending on cache settings, don't forget to Invalidate between tests.

已回答 5 年前
profile picture
專家
已審閱 1 個月前
0

Hi Thanos,

Be sure your source files on S3 have 'Cache-Control' AND 'Content-Type' metadata set (under properties). For content-type for javascript, I believe use value: text/javascript
If I recall correctly, this must be set for compression to work.

If you have made changes (from above, or just trying things before), be sure to invalidate the path in CloudFront:
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html

Invalidation is required if any changes on s3 or it will drive you nuts - making changes and nothing happens.

Hope this helps. Let me know if it works or not.

已回答 5 年前
profile picture
專家
已審閱 1 個月前
0

Thank you Lily.
I checked both files and they both have the same metadata(only content-type: application/javascript)

Both files are the same in terms of metadata, how they were uploaded, where they are hosted, etc. the only thing that change is the size.

Is it possible that the click-chat file is not gziped due to the low file size? (Size 841.0 B) compared to tracker (Size 68.3 KB) that is served gziped?

已回答 5 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南