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

asked 9 months ago1934 views
1 Answer
1
Accepted Answer

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
EXPERT
answered 9 months ago
profile picture
EXPERT
Steve_M
reviewed 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions