文档

0034-00000002

更新时间:

问题描述

跨域资源共享CORS(Cross-Origin Resource Sharing)配置中缺少配置规则。

问题原因

您通过PutBucketCors接口来配置某个Bucket的跨域资源共享规则,但是您提交的XML配置中没有CORS规则。

问题示例

比如您发起了如下请求:

PUT /?cors HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Content-Length: 186
Date: Fri, 04 May 2012 03:21:12 GMT
Authorization: OSS qn6qrrqxo2oawuk53otf****:KU5h8YMUC78M30dXqf3JxrT*****
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration>
</CORSConfiguration >

因为上述XML配置中没有<CORSRule>标签描述跨域共享规则,就会得到该错误。

解决方案

在通过PutBucketCors接口来配置某个Bucket跨域资源共享规则时,请确保您提交的XML配置中至少存在一条CORS规则:

PUT /?cors HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Content-Length: 186
Date: Fri, 04 May 2012 03:21:12 GMT
Authorization: OSS qn6qrrqxo2oawuk53otf****:KU5h8YMUC78M30dXqf3JxrT*****
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration>
    <CORSRule>
      <AllowedOrigin>*</AllowedOrigin>
      <AllowedMethod>PUT</AllowedMethod>
      <AllowedMethod>GET</AllowedMethod>
      <AllowedHeader>Authorization</AllowedHeader>
    </CORSRule>
    <ResponseVary>false</ResponseVary>
</CORSConfiguration >

相关文档

  • 本页导读 (1)
文档反馈