Problem description
The AllowedMethod parameter of a rule in the XML configuration for cross-origin resource sharing (CORS) is invalid.
Causes
You called the PutBucketCors operation to configure CORS rules for a bucket. The value of the AllowedMethod parameter in a rule of the submitted XML configuration is not within the valid range.
Examples
For example, you initiate 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>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod></AllowedMethod>
<AllowedMethod>TEST</AllowedMethod>
<AllowedHeader>Authorization</AllowedHeader>
</CORSRule>
<ResponseVary>true</ResponseVary>
</CORSConfiguration>The AllowedMethod parameter specifies the allowed methods for cross-origin requests, which must be GET, PUT, DELETE, POST, or HEAD. In the preceding XML configuration, the AllowedMethod nodes are invalid because they contain an empty string and "TEST".
Solutions
When you call the PutBucketCors operation to configure CORS rules for a bucket, the submitted XML configuration must be valid. Specifically, the AllowedMethod parameter must be set to a valid method.
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>