Reputation: 22183
Is it possible to instruct Amazon S3 or Cloudfront to deliver certain static files (html, css, and javascript files) to be delivered with a compressed gzip header? Even if the .gz file is around on the server?
Upvotes: 2
Views: 2547
Reputation: 191
Now you can use Amazon CloudFront that can serve both compressed and uncompressed files from an origin server.
From Amazon docs:
CloudFront doesn't compress the files itself. Instead, it relies on receiving compressed files from your origin. The process for serving compressed files depends on whether you're using a custom origin or Amazon S3:
Custom origins: CloudFront relies on the origin server to respond to requests with compressed files. For more information, see How CloudFront Serves Compressed Content from a Custom Origin.
Amazon S3 origins: Amazon S3 doesn't compress files automatically, so you must create separate compressed and uncompressed versions of the files that you want to serve in compressed format. In addition, you develop your web application to rewrite URLs when viewers request compressed content. For more information, see Serving Compressed Files from Amazon S3.
Upvotes: 1
Reputation: 22183
The only way I've found to do this is to compress the file locally, upload it to S3, and the setup a Content-Encoding: gzip
header for the file. This works, but the problem is that for any client that doesn't accept encoded data then it will parse and read the compressed data of the file.
Upvotes: 2
Reputation: 82765
You can do this using tools such as DragonDisk S3 (Freeware), Bucket Explorer, Cloudberry....
Upvotes: 0