Search code examples
javascriptgoogle-chromegzipamazon-cloudfront

Gzipped Javascript from Cloudfront (S3 origin)


I've seen this question asked all over, but couldn't find anything that adresses my issue. I have gzipped ( YUI compressor ) my javascript file, uploaded it to s3 with the headers suggested here: http://blog.kenweiner.com/2009/08/serving-gzipped-javascript-files-from.html

Used the proposed gzipcheck.js.jgz to set "gzipenabled" to true to decide whether to load gzipped content or not; but in most browsers I still get illegal character errors when the gzipped javascript is loaded.

Its filled with: u��Q �^[J�ta�Є���7������t�������


Solution

  • Changing "Content-Type: application/x-gzip" to "Content-Type: application/x-javascript" fixed this.