0034-00000008

更新时间:
复制 MD 格式

Problem description

The AllowedOrigin parameter is missing from a rule in the cross-origin resource sharing (CORS) XML configuration.

Causes

The AllowedOrigin parameter is missing from a CORS rule in the XML request body of the PutBucketCors operation.

Examples

For example, consider the following 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>
      <AllowedMethod>PUT</AllowedMethod>
      <AllowedMethod>GET</AllowedMethod>
      <AllowedHeader>Authorization</AllowedHeader>
    </CORSRule>
    <ResponseVary>true</ResponseVary>
</CORSConfiguration>

The AllowedOrigin parameter specifies the origins from which cross-origin requests are allowed. You can use multiple AllowedOrigin elements to specify multiple allowed origins. This parameter is required. This error occurs because the AllowedOrigin node is missing from the `CORSRule` element in the sample request.

Solutions

When you use the PutBucketCors operation to configure CORS rules for a bucket, make sure that the XML configuration is valid. The configuration must include 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