Skip to main content

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

NameLocationTypeRequiredSample valueDescription
CORSConfigurationBODYcontainerYesnot involvedCORS rule container for bucket.
AllowedMethodBODYenumeration stringYesGETspecifies the allowed cross-domain request method. optional values: GET, PUT, DELETE, POST, HEAD
MaxAgeSecondsBODYintegerNo100specifies 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.
regionIdBODYstringYesNo sample value for this parameter.region id
CORSRuleBODYcontainerYesnot involvedCORS rule container. Each bucket allows up to 10 rules.
ExposeHeaderBODYstringNox-oss-testspecifies the response header (such as a Javascript XMLHttpRequest object) that users are allowed to access from the application.) The asterisk (*) wildcard is not allowed.
AllowedOriginBODYstringYes*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.
AllowedHeaderBODYstringNoAuthorizationcontrols 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.
versionBODYstringNo2016-01-01version of api

Return data

NameTypeSample valueDescription
RequestIDstring1E3D5A1E0-67CA-43DA-24BC-EAF2D5A1E4DCRequest id

Example

Successful Response example

{
"RequestID":"1E3D5A1E0-67CA-43DA-24BC-EAF2D5A1E4DC"
}

Failed Response example

{
"errorSample":
{
"resultCode":-1,
"resultMsg":"system error",
"result":null
}

}