问题描述
静态网站配置请求中提供的XML格式有误。
问题原因
您发起了PutBucketWebSite请求,但是提交的XML配置有误。
问题示例
比如您发起了如下请求:
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>
可以看到,上述请求中缺少名为WebsiteConfiguration
的根节点,在这种情况下,就会报该错误。
解决方案
请结合OSS返回的ErrorMessage和ErrorDetail内容进行调整,也可以参考相关文档中的请求示例。比如对于上面的请求,OSS会返回如下的相应:
<?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>
其中ErrorDetial中指出根节点不是WebsiteConfiguration。因此,可以根据该提示将请求修改为:
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>
相关文档
该文章对您有帮助吗?