Amazon S3 is not serving files correctly

Alexsander Akers picture Alexsander Akers · Apr 11, 2010 · Viewed 27.4k times · Source

I made this site for my friend and I uploaded it to an Amazon S3 bucket (http://ballard26.s3.amazonaws.com/index.html) and when I go to that site the page doesn't load correctly and I have no idea why. Any ideas?

For example, the stylesheet.css doesn't load correctly. If you go to http://ballard26.s3.amazonaws.com/stylesheet.css, it downloads the file instead of loading it as CSS.

Answer

jnoss picture jnoss · Apr 11, 2010

Check the mime types (HTTP content type header) on the files you uploaded. S3 does not always set them correctly. You may need to set them on the upload API call. Some upload libraries will do this for you.

If the mime types are not correct when the file is downloaded from the browser from S3 if the mime type is not set correctly it will not always render correctly.