Problem description
AllowedMethod in the PutBucketCors request body contains an invalid value, causing the CORS configuration to fail.
Causes
The AllowedMethod element in the XML request body of PutBucketCors accepts only the following five HTTP methods:
| Valid value |
|---|
GET |
PUT |
DELETE |
POST |
HEAD |
Any other value—including an empty string—causes the request to fail.
Examples
The following request fails because AllowedMethod contains two invalid values: an empty string and TEST.
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>Solutions
Set each AllowedMethod element to one of the five valid values: GET, PUT, DELETE, POST, or HEAD.
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>