PutBucketCors

Prev Next

Available in Classic and VPC

Register Cross-Origin Resource Sharing (CORS) settings for an Ncloud Storage bucket or overwrite existing settings.

Request

This section describes the request format. The method and URI are as follows:

Method URL
PUT -

Request headers

For information about the headers common to all Ncloud Storage APIs, see Ncloud Storage request headers. However, you must include either the Content-MD5 or x-amz-checksum-sha256 header in your request.

Request body

You can include the following data in the body of your request:

Field Type Required Description
CORSConfiguration - Required Root elements of CORS configuration
CORSConfiguration.CORSRule List Required CORS rule list
  • Up to 100 can be entered.
CORSConfiguration.CORSRule.ID String Optional Rule name
  • Up to 255 characters can be entered.
  • Unique value within the rule
  • Automatically generated if omitted
CORSConfiguration.CORSRule.AllowedMethod List Required HTTP method to allow
  • Specify one or more among GET, PUT, POST, DELETE, HEAD.
CORSConfiguration.CORSRule.AllowedOrigin List Required Origin to allow
  • Wildcards (*) can be used, and only one is allowed per origin.
CORSConfiguration.CORSRule.AllowedHeader List Optional Request header to allow
  • Wildcards (*) can be used, and only one is allowed per header.
CORSConfiguration.CORSRule.ExposeHeader List Optional Response header to display to the browser
  • Wildcards (*) can't be used.
CORSConfiguration.CORSRule.MaxAgeSeconds Integer Optional Time the browser caches the preflight response (second)
Note
  • If CORSRule is missing, or if AllowedMethod or AllowedOrigin is omitted, an error is returned.
  • Only one wildcard (*) is allowed per entry in AllowedOrigin and AllowedHeader.
  • Wildcards (*) cannot be used in ExposeHeader.
  • An error is returned if CORSRule.ID is duplicated.

Request example

The request example is as follows:

PUT /?cors HTTP/1.1
Host: bucket.kr.ncloudstorage.com
Content-MD5: Q2hlY2sgSW50ZWdyaXR5IQ==

<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <CORSRule>
        <ID>rule1</ID>
        <AllowedMethod>GET</AllowedMethod>
        <AllowedMethod>PUT</AllowedMethod>
        <AllowedOrigin>https://example.com</AllowedOrigin>
        <AllowedHeader>*</AllowedHeader>
        <ExposeHeader>x-amz-server-side-encryption</ExposeHeader>
        <MaxAgeSeconds>3600</MaxAgeSeconds>
    </CORSRule>
</CORSConfiguration>

Response

This section describes the response format.

Response headers

For information about the headers common to all Ncloud Storage APIs, see Ncloud Storage response headers.

Response status codes

For information about the HTTP status codes common to all Ncloud Storage APIs, see Common Ncloud Storage response status codes.

Response example

The response example is as follows:

HTTP/1.1 200 OK