schermee
schermee

Reputation: 3

Gzip with Amazon S3/Cloudfront Fail

I have a site I host on Amazon s3 and distribute through Cloudfront. I am attempting to serve gzipped files. So far I have done the following: 1) gzipped my files.

2) uploading my gzipped files to s3. I now have both the uncompressed and gzipped copies in the bucket. Example: style.css and style.css.gz are in the bucket

3) I made the files public.

4) I checked the metadata on the files and it appears that Amazon already put in Content-Type: application/x-gzip. I assume this is correct.

5) I then add the Content-Encoding by going to the metadata and adding a new piece of metadata: Content-Encoding: gzip

I thought that was all I had to do, but when I go to my webpage now it simply downloads copies of the html files instead of displaying them. Am I missing anything? Im a beginner here so anything helps. Thanks

Upvotes: 0

Views: 749

Answers (1)

Michael - sqlbot
Michael - sqlbot

Reputation: 179414

Content-Type: application/x-gzip is wrong. The content type must be set to the actual content type of the files, e.g. text/html.

Content-Encoding: gzip is correct and is required.

Upvotes: 2

Related Questions