Cloudfront distribution downloading instead of showing content

0

I'm trying to get a very simple website up and running using cloudfront and s3 from AWS. I managed to configure everything, but when I access my page, instead of showing the file content, it downloads the content. can you help me? Thanks in advance.

Below are some things that may help:

Bucket Policy:

Enter image description here

Origin configuration in cloudfront:

Enter image description here

已提问 9 个月前2169 查看次数
1 回答
1
已接受的回答

Hello.
The content type of the object placed in S3 may not be "text/html".
Try changing the content type with the following command.

aws s3 cp --content-type text/html s3://your-bucket-name/index.html s3://your-bucket-name/index.html --recursive

Also, delete the CloudFront cache after making the change.
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html#Invalidation_Requests

profile picture
专家
已回答 9 个月前
profile picture
专家
Steve_M
已审核 9 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则