ListBucketResult xml 试图通过 CloudFront 在 S3 中显示站点的主页 [英] ListBucketResult xml trying to show home page of site in S3 thorugh CloudFront
问题描述
我创建了一个存储桶,用于托管我的静态网站.
我设置属性以将其用作静态网站托管(其中索引文档值 index.html)
网址为:
<块引用>可选.您希望 CloudFront 返回的对象(例如,index.html) 当查看器请求指向您的根 URL 时(http://www.example.com) 而不是您的特定对象分发(http://www.example.com/index.html).
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
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:
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).
这篇关于ListBucketResult xml 试图通过 CloudFront 在 S3 中显示站点的主页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!