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
|
CORSConfiguration.CORSRule.ID |
String | Optional | Rule name
|
CORSConfiguration.CORSRule.AllowedMethod |
List | Required | HTTP method to allow
|
CORSConfiguration.CORSRule.AllowedOrigin |
List | Required | Origin to allow
|
CORSConfiguration.CORSRule.AllowedHeader |
List | Optional | Request header to allow
|
CORSConfiguration.CORSRule.ExposeHeader |
List | Optional | Response header to display to the browser
|
CORSConfiguration.CORSRule.MaxAgeSeconds |
Integer | Optional | Time the browser caches the preflight response (second) |
- If
CORSRuleis missing, or ifAllowedMethodorAllowedOriginis omitted, an error is returned. - Only one wildcard (
*) is allowed per entry inAllowedOriginandAllowedHeader. - Wildcards (
*) cannot be used inExposeHeader. - An error is returned if
CORSRule.IDis 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