PutBucketcors
Description
PutBucketcors interface is used to set a cross-domain resource sharing (CORS) rule for the specified bucket. If the bucket already has CORS rules, using this interface overwrites the original rules. By default, the CORS function is not enabled in a bucket, and the Origin of all cross-domain requests is not allowed.
Request Method
POST
Request Path
/apsara/route/OneRouter/PutBucketcors
Request Parameters Common Parameters
Name | Location | Type | Required | Sample value | Description |
---|---|---|---|---|---|
CORSConfiguration | BODY | container | Yes | not involved | CORS rule container for bucket. |
AllowedMethod | BODY | enumeration string | Yes | GET | specifies the allowed cross-domain request method. optional values: GET, PUT, DELETE, POST, HEAD |
MaxAgeSeconds | BODY | integer | No | 100 | specifies the cache time, in seconds, for the result returned by the browser's prefetch (OPTIONS) request for a specific resource. At most one is allowed in a CORSRule. |
regionId | BODY | string | Yes | No sample value for this parameter. | region id |
CORSRule | BODY | container | Yes | not involved | CORS rule container. Each bucket allows up to 10 rules. |
ExposeHeader | BODY | string | No | x-oss-test | specifies the response header (such as a Javascript XMLHttpRequest object) that users are allowed to access from the application.) The asterisk (*) wildcard is not allowed. |
AllowedOrigin | BODY | string | Yes | * | specifies the source of allowed cross-domain requests, allowing multiple elements to be used to specify multiple allowed sources. Allow up to one asterisk (*) wildcard. If specified as an asterisk (*), cross-domain requests from all sources are allowed. |
AllowedHeader | BODY | string | No | Authorization | controls whether the header specified in the Access-Control-Request-Headers header in the OPTIONS prefetch instruction is allowed. Each header specified in Access-Control-Request-Headers must have a corresponding item in the AllowedHeader. Up to one asterisk (*) wildcard is allowed. |
version | BODY | string | No | 2016-01-01 | version of api |
Return data
Name | Type | Sample value | Description |
---|---|---|---|
RequestID | string | 1E3D5A1E0-67CA-43DA-24BC-EAF2D5A1E4DC | Request id |
Example
Successful Response example
{
"RequestID":"1E3D5A1E0-67CA-43DA-24BC-EAF2D5A1E4DC"
}
Failed Response example
{
"errorSample":
{
"resultCode":-1,
"resultMsg":"system error",
"result":null
}
}