0034-00000010

更新时间:
复制 MD 格式

Problem description

A rule in the cross-origin resource sharing (CORS) XML configuration is missing the AllowedMethod parameter.

Cause

You used the PutBucketCors operation to configure CORS rules for a bucket. However, the submitted XML configuration is invalid because a rule is missing the AllowedMethod parameter.

Sample problems

The following is a sample request:

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 qn6q**************:77Dv****************
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration>
    <CORSRule>
      <AllowedOrigin>*</AllowedOrigin>
      <AllowedHeader>Authorization</AllowedHeader>
    </CORSRule>
    <ResponseVary>true</ResponseVary>
</CORSConfiguration>

The AllowedMethod parameter specifies the allowed methods for cross-origin requests. Valid values include GET, PUT, DELETE, POST, and HEAD. This parameter is required. This error occurs because the AllowedMethod node is missing from the CORSRule in the sample request.

Solution

Ensure that the XML configuration submitted for the PutBucketCors operation is valid and that each rule includes the AllowedOrigin and AllowedMethod parameters.

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 qn6q**************:77Dv****************
<?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>

References