Amazon s3 bucket dumps entire content in XML upon visiting index
So something weird happened, I've set up my AWS S3 bucket for static website hosting, and it all works perfectly fine, but whenever I go to plain domain (For example: 'test.com') It returns an XML file error, followed by dumping all the content in that XML. It'll look like this, but the rest of the domains like 'test.com/test' does work.. I have index.html set as my index in my bucket, and everything seems to be properly configured. Any help?
Also, going to 'test.com/index' does in fact show the index fine, only when you go to 'test.com' does it give the XML error.
When you setup S3 static web site hosting, the bucket name must match the domain name exactly. If you want to support more than one domain name, then you will need more than one bucket.
Let's say that you want to host mywebsite.com and www.mywebsite.com on S3. You will need to create two buckets "mywebsite.com" and "www.mywebsite.com". Then create two Route53 entries for each domain name / bucket pair.
You can have one web site redirect to the other.
Setting up a Static Website Using a Custom Domain
Since this works: test.com/index
but this doesn't: test.com
it sounds like you uploaded an index file named index
not index.html
. In that case you need to make sure your index document settings in your S3 bucket's static website configuration is index
instead of the default value of index.html
which is what you said you currently have configured.
Alternatively, if you have index.html
in other folders in the bucket already, which appears to be the case since you said test.com/test
works, then you simply need to rename the root index
file to be index.html
.
You have two problems:
How do you list the objects in a bucket? You go to the root of the REST endpoint of the bucket... so what you're seeing is not an XML "error" -- it's a bucket listing.
This, in turn, reveals the second problem:
The web site hosting features are only available from the web site endpoints.
http://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteEndpoints.html
链接地址: http://www.djcxy.com/p/70224.html上一篇: AWS S3共享访问静态网站