Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ListBucketResult xml trying to show home page of site in S3 thorugh CloudFront

I created a bucket where I´m hosting my static website.

I set the properties to use it as static website hosting (which index document value index.html)

The URL was: http://mywebsitelearningcurve.s3-website-us-east-1.amazonaws.com (not currently up, just to explain)

I exposed it as public (permission).

Overview of my bucket

/images
/static
/asset-manifest.json
/favicon.ico
/index.html
/manifest.json
/service-worker.js

Using http://mywebsitelearningcurve.s3-website-us-east-1.amazonaws.com I could access to my site. However I decided to use CloudFront in front of my bucket.

I created a new distribution for WEB.

On Origin Domain Name I used mywebsitelearningcurve.s3.amazonaws.com

Origin ID: S3-mywebsitelearningcurve

In Viewer Protocol Policy I selected: Redirect HTTP to HTTPS.

Once it finished and I waited for a prudential time to propagate, I had the url https://d2qf2r44tssakh.cloudfront.net/ (not currently up, just to explain).

The issue: When I tried to use https://d2qf2r44tssakh.cloudfront.net/ it showed me a xml

<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Name>mywebsitelearningcurve</Name>
...
...
...
</ListBucketResult>

However, when I tried https://d2qf2r44tssakh.cloudfront.net/index.html it works properly.

I go through several tutos and post but I can´t still make it work. Anyone can provide help? Thanks

like image 735
Peter Avatar asked Jun 16 '18 22:06

Peter


People also ask

How do I access my S3 bucket from CloudFront?

Open the CloudFront console. Choose Create Distribution. Under Origin, for Origin domain, choose your S3 bucket's REST API endpoint from the dropdown list. Or, enter your S3 bucket's website endpoint.

How do I fix CloudFront error 403?

A custom origin is returning the 403 error A 403 error might be caused by an AWS WAF or custom firewall configuration made at the origin. To troubleshoot, make the request directly to the origin. If you can replicate the error without CloudFront, then the origin is causing the 403 error.

Can CloudFront stream content using RTMP?

CloudFront only supports on demand RTMP streaming[1]. However, you can do live HTTP streaming, as you mentioned, using Wowza and CloudFront[2].


1 Answers

I had the same problem today and was able to fix it by adding index.html to the Default Root Object in the distribution settings:

enter image description here

Optional. The object that you want CloudFront to return (for example, index.html) when a viewer request points to your root URL (http://www.example.com) instead of to a specific object in your distribution (http://www.example.com/index.html).

like image 139
Andre Gallo Avatar answered Nov 30 '22 14:11

Andre Gallo