Null Disquisition

Python, AWS, Grad School, and your face

Serve gzipped content from Amazon S3

with 3 comments

gzipper

Set the “Content-encoding” header to “gzip”. Really, it’s that easy.

Kthxbye.

Well, since you came all this way, I’ll give a little more detail. First, make a file.

Now gzip it.

Upload it.

Find a utility that can modify file headers on S3: S3Hub (OS X), Cloudberry S3 Explorer (Windows), or any of the various 3rd party libraries.

Set the Content-type header to whatever the appropriate content type is: text/plain, text/css, text/javascript, image/jpeg, etc.

Set the Content-encoding to gzip.

Pat yourself on the back.

Here’s three versions of a text file I made and gzipped. Note that with appropriate headers, file extensions don’t mean squat.

  1. http://mumrah-dot-net.s3.amazonaws.com/gziptest.txt.gz
  2. http://mumrah-dot-net.s3.amazonaws.com/gziptest.txt
  3. http://mumrah-dot-net.s3.amazonaws.com/gziptest

Go ahead and download one – you’ll see that the file is actually gzipped and your browser is doing the deflating on the fly. This is the same effect producted by mod_deflate in Apache.

-David

Written by david

May 5th, 2009 at 12:15 am

3 Responses to 'Serve gzipped content from Amazon S3'

Subscribe to comments with RSS or TrackBack to 'Serve gzipped content from Amazon S3'.

  1. thanks!

    you made my day! added a couple of points to my yslow! grade…

    sambit

    4 Aug 09 at 6:21 am

  2. [...] Lab was inspired by the blog post Serve gzipped content from Amazon S3 and we would like to thank you the author David Arthur for the idea and for mentioning CloudBerry [...]

  3. [...] Lab was inspired by the blog post Serve gzipped content from Amazon S3 and we would like to thank you the author David Arthur for the idea and for mentioning CloudBerry [...]

Leave a Reply