1

My first deploy to AWS. The files are all in place, and index.html loads. There are two files in a subdir, one .js and once .css. They both return 200 but fail to load. Chrome sais it's the 'parser'.

After trying a few things, I noted that this property is causing it: ContentEncoding: "gzip".

If I remove this property the files are found correctly.

Am I using this property incorrectly?

I am using the Node AWS SDK via this great project: https://github.com/MathieuLoutre/grunt-aws-s3

You can witness this behavior for yourself at http://tidepool.co.s3-website-us-west-1.amazonaws.com/

SimplGy
  • 20,079
  • 15
  • 107
  • 144

2 Answers2

3

If you specify Content-Encoding: gzip then you need to make sure that the content is actually gzipped on S3.

From what I see in this CSS file:

http://tidepool.co.s3-website-us-west-1.amazonaws.com/08-26_6483218-dirty/all-min.css

the actual content is not gzipped, but the Content-Encoding: gzip header is present.

Also keep in mind that S3 is unable to compress your content on the fly based on the Accept-Encoding header in the request. You can either store it uncompressed and it will work for all browsers/clients or store it in a compressed format (gzip/deflate) and it will only work on some clients that can work with compressed content.

dcro
  • 13,294
  • 4
  • 66
  • 75
  • 1
    Oh. Wow. I had no idea I had to do this manually. I thought all web servers did this automaticallyish (mod_deflate). Thanks for the heads up on Accept-Encoding, too! – SimplGy Aug 27 '13 at 16:24
  • Serving gzip from s3: http://stackoverflow.com/questions/5442011/serving-gzipped-css-and-javascript-from-amazon-cloudfront-via-s3 – SimplGy Aug 27 '13 at 16:29
0

You could also take a look at the official AWS SDK for Node.js.

Ryan Parman
  • 6,855
  • 1
  • 29
  • 43
  • I could, but the grunt toolchain is really nice as a package. There's some efficiency in staying in one framework, don't you think? Or would it be worth it in your view to write the s3 uploads as custom scripts which the build chain triggers? – SimplGy Sep 02 '13 at 03:12