Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Website hosted on S3 just downloads a blank file?

I have an extremely simple website, literally just an HTML file with some text in it. I configured my bucket for hosting and set the homepage to index.html. I set the permissions per the AWS tutorial here: https://docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-custom-domain-walkthrough.html

For some reason, when I hit the website endpoint, Chrome is prompted to save a file called "download". If I save the file and open it, it is just blank, zero bytes. Why is my index.html file not served up?

UPDATE: I fixed the empty file issue, but it still wants to download my page instead of open it in the browser...

FIXED: The content-type was set incorrectly. When uploading the file, I had to explicitly the set the content type property to text/html or text/css.

like image 781
cava23 Avatar asked Sep 08 '14 23:09

cava23


1 Answers

You need to set the Metadata properly - content-type as text/html for your html pages. Once this is through the browser would start to render the pages in the browser rather than downloading them.

like image 70
Naveen Vijay Avatar answered Sep 30 '22 19:09

Naveen Vijay