Amazon CloudFront and GZIP

If you look at my posts here, you can tell that I have a bit of a love affair with Amazon Web Services. I won’t deny it either, because I do. But, just because I love AWS doesn’t mean that it’s perfect. Like any relationship, it’s far from it.

Recently I moved from Amazon S3 to CloudFront with a custom origin. CloudFront’s custom origin option essentially makes CF a pull CDN. After looking at the the front page I noticed that the CSS wasn’t loading – at all! In fact, it wasn’t even there!

Upon further research, I realized CF doesn’t handle GZipped content when using custom origins.

Obviously, that’s an issue since gzip is one of the ways I make this whole thing run fast.

In order to serve GZipped content via CF, you have to use both S3 and CF together. Your S3 bucket becomes your CF distribution origin.

Though it’s round about, it works very well.

Hope that’s helpful!