Problem description
The XML body of the static website configuration request is incorrectly formatted.
Causes
The XML data in the body of the PutBucketWebSite request is invalid.
Examples
For example, you initiate the following request:
PUT /?website HTTP/1.1
Date: GMT Date
Content-Length: ContentLength
Content-Type: application/xml
Host: BucketName.oss-cn-hangzhou.aliyuncs.com
Authorization: SignatureValue
<?xml version="1.0" encoding="UTF-8"?>
<IndexDocument>
<Suffix>index.html</Suffix>
</IndexDocument>
<ErrorDocument>
<Key>errorDocument.html</Key>
<HttpStatus>404</HttpStatus>
</ErrorDocument>The error is returned for the sample request because the WebsiteConfiguration root node does not exist.
Solutions
Adjust your XML configuration based on the error message and error details returned by Object Storage Service (OSS) or the sample requests provided in the reference documents. For example, OSS returns the following response to the preceding sample request:
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>MalformedXML</Code>
<Message>The XML you provided was not well-formed or did not validate against our published schema.</Message>
<RequestId>63D5E36B595B843930AD9B72</RequestId>
<HostId>zmf-dinary.oss-cn-hangzhou-zmf.aliyuncs.com</HostId>
<ErrorDetail>The root node is not named WebsiteConfiguration.</ErrorDetail>
<EC>0019-00000001</EC>
</Error>In the response, the ErrorDetial parameter indicates that the root node is not WebsiteConfiguration. You can fix this problem by modifying the request body, as shown in the following sample request:
PUT /?website HTTP/1.1
Date: GMT Date
Content-Length: ContentLength
Content-Type: application/xml
Host: BucketName.oss-cn-hangzhou.aliyuncs.com
Authorization: SignatureValue
<?xml version="1.0" encoding="UTF-8"?>
<WebsiteConfiguration>
<IndexDocument>
<Suffix>index.html</Suffix>
</IndexDocument>
<ErrorDocument>
<Key>errorDocument.html</Key>
<HttpStatus>404</HttpStatus>
</ErrorDocument>
</WebsiteConfiguration>