LoginSignup
9
7

More than 5 years have passed since last update.

AWS CloudFrontで自動gzip圧縮

Posted at

いつの間にかCloudFrontにgzip圧縮機能が追加されていました。
特に、S3をoriginとするとaccept-encodingによる分岐ができないため、この機能の追加は非常にありがたいです。
AWS Consoleからチェックボックスで簡単に有効化できます。

2015/12/17にさりげなく発表されてました。見落としてた。。。
New – Gzip Compression Support for Amazon CloudFront

コスト

追加のコストは発生せず、転送量が減る分むしろ安くなるようです。

There is no extra charge for the compression; your CloudFront data transfer charges may actually go down (the specifics depend on the proportion of compressed to uncompressed requests, of course).

注意

既存のDistributionに対して圧縮う有効にした場合、キャッシュが消えないケースがあるようです。念のため一度invalidateしたほうがよさそうですね。

Content already in edge locations when you configure CloudFront to compress files
CloudFront compresses files in each edge location when it gets the files from your origin. When you configure CloudFront to compress your content, it doesn't compress files that are already in edge locations. In addition, when a file expires in an edge location and CloudFront forwards another request for the file to your origin, CloudFront doesn't compress the file if your origin returns an HTTP status code 304, which means that the edge location already has the latest version of the file. If you want CloudFront to compress the files that are already in edge locations, you'll need to invalidate those files. For more information, see Invalidating Objects (Web Distributions Only).

9
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
7