All Products
Search
Document Center

Object Storage Service:0034-00000011

Last Updated:Apr 29, 2024

Problem description

The AllowedMethod parameter of a cross-origin resource sharing (CORS) rule in the XML CORS configuration is invalid.

Causes

The AllowedMethod parameter of a CORS rule in the XML request body of the PutBucketCors operation is set to an invalid value.

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 HTTP methods that cross-origin requests are allowed to use. The valid values of the parameter are GET, PUT, DELETE, POST, and HEAD. In the preceding XML configuration, the two values of the AllowedMethod parameter in the CORSRule element are invalid: the first is an empty string and the second is TEST.

Solutions

Make sure that the value of the AllowedMethod parameter in the XML request body of the PutBucketCors operation is valid.

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