TomatoMan
TomatoMan

Reputation: 51

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.

Upvotes: 5

Views: 6821

Answers (4)

Sanjay Verma
Sanjay Verma

Reputation: 1616

Here is how I fixed this for my website https://ixtutor.com : https://aws.amazon.com/premiumsupport/knowledge-center/s3-returns-objects/ - you probably need to setup the "Default Root Object" in cloudfront correctly, which should be "index.html" instead of empty.

Upvotes: 1

Michael - sqlbot
Michael - sqlbot

Reputation: 179054

You have two problems:

  • You've misconfigured the bucket ACL or policy to allow everyone to list the objects in the bucket.

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:

  • You've configured your domain to point to the REST endpoint, not the web site hosting endpoint.

The web site hosting features are only available from the web site endpoints.

http://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteEndpoints.html

Upvotes: 3

Mark B
Mark B

Reputation: 200537

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.

Upvotes: 0

John Hanley
John Hanley

Reputation: 81356

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

Upvotes: 0

Related Questions