forked from docs/doc-exports
Reviewed-by: Sabelnikov, Dmitriy <dmitriy.sabelnikov@t-systems.com> Co-authored-by: zhangyue <zhangyue164@huawei.com> Co-committed-by: zhangyue <zhangyue164@huawei.com>
169 lines
13 KiB
HTML
169 lines
13 KiB
HTML
<a name="EN-US_TOPIC_0125560258"></a><a name="EN-US_TOPIC_0125560258"></a>
|
|
|
|
<h1 class="topictitle1">GET Bucket CORS</h1>
|
|
<div id="body57352691"><p class="msonormal" id="EN-US_TOPIC_0125560258__p49678097">You can use this operation to obtain CORS configuration information about a specified bucket.</p>
|
|
<p class="msonormal" id="EN-US_TOPIC_0125560258__p44449691">Only users granted the <strong id="EN-US_TOPIC_0125560258__b46412171">s3:GetBucketCORS</strong> permission can perform this operation. By default, only the bucket owner can perform this operation. The bucket owner can allow other users to perform this operation by granting them the permission.</p>
|
|
<div class="section" id="EN-US_TOPIC_0125560258__section45406920"><h4 class="sectiontitle">Request Syntax</h4><pre class="screen" id="EN-US_TOPIC_0125560258__screen9964730123016"> GET /?cors HTTP/1.1
|
|
User-Agent: agent
|
|
Host: bucketname.obs.example.com
|
|
Accept: */*
|
|
Date: date
|
|
Authorization: authorization</pre>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560258__section6009104"><h4 class="sectiontitle">Request Parameters</h4><p id="EN-US_TOPIC_0125560258__p29113138">This request involves no parameters.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560258__section54081941"><h4 class="sectiontitle">Request Headers</h4><p id="EN-US_TOPIC_0125560258__p9353940">This request uses common headers. For details about common request headers, see section <a href="en-us_topic_0125560462.html">Common Request Headers</a>.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560258__section16975424"><h4 class="sectiontitle">Request Elements</h4><p id="EN-US_TOPIC_0125560258__p33703167">This request involves no elements.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560258__section42383756"><h4 class="sectiontitle">Response Syntax</h4><pre class="screen" id="EN-US_TOPIC_0125560258__screen21343599122943">HTTP/1.1 status_code
|
|
Server: Server Name
|
|
x-amz-request-id: id
|
|
x-amz-id-2: id
|
|
x-reserved: reserved info
|
|
Content-Type: type
|
|
Date: date
|
|
Content-Length: lenth
|
|
|
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
<CORSConfiguration xmlns="http://obs.example.com/doc/2015-06-30/">
|
|
<CORSRule>
|
|
...
|
|
</CORSRule>
|
|
</CORSConfiguration></pre>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560258__section45909486"><h4 class="sectiontitle">Response Headers</h4><p id="EN-US_TOPIC_0125560258__p32412869">This response uses common headers. For details about common response headers, see section <a href="en-us_topic_0125560484.html">Common Response Headers</a>.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560258__section10532193"><h4 class="sectiontitle">Response Elements</h4><p id="EN-US_TOPIC_0125560258__p59953189">This response contains elements to detail the CORS configuration. <a href="#EN-US_TOPIC_0125560258__table34893051">Table 1</a> describes the elements.</p>
|
|
|
|
<div class="tablenoborder"><a name="EN-US_TOPIC_0125560258__table34893051"></a><a name="table34893051"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0125560258__table34893051" frame="border" border="1" rules="all"><caption><b>Table 1 </b>CORS configuration elements</caption><thead align="left"><tr id="EN-US_TOPIC_0125560258__row38731421"><th align="left" class="cellrowborder" valign="top" width="29.110000000000003%" id="mcps1.3.9.3.2.3.1.1"><p id="EN-US_TOPIC_0125560258__p50237402">Element</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="70.89%" id="mcps1.3.9.3.2.3.1.2"><p id="EN-US_TOPIC_0125560258__p42697780">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0125560258__row35968146"><td class="cellrowborder" valign="top" width="29.110000000000003%" headers="mcps1.3.9.3.2.3.1.1 "><p id="EN-US_TOPIC_0125560258__p27738717">CORSConfiguration</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="70.89%" headers="mcps1.3.9.3.2.3.1.2 "><p id="EN-US_TOPIC_0125560258__p32243580">Indicates the <strong id="EN-US_TOPIC_0125560258__b21756767">CORSRules</strong> root node. The maximum size is 64 KB.</p>
|
|
<p id="EN-US_TOPIC_0125560258__p61593176">Type: Container</p>
|
|
<p id="EN-US_TOPIC_0125560258__p17467672">Ancestor: None</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0125560258__row22991320"><td class="cellrowborder" valign="top" width="29.110000000000003%" headers="mcps1.3.9.3.2.3.1.1 "><p id="EN-US_TOPIC_0125560258__p50357604">CORSRule</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="70.89%" headers="mcps1.3.9.3.2.3.1.2 "><p id="EN-US_TOPIC_0125560258__p52434149">Indicates a CORS rule. <strong id="EN-US_TOPIC_0125560258__b136115120613">CORSConfiguration</strong> can contain a maximum of 100 rules.</p>
|
|
<p id="EN-US_TOPIC_0125560258__p19307715">Type: Container</p>
|
|
<p id="EN-US_TOPIC_0125560258__p39551712">Ancestor: <strong id="EN-US_TOPIC_0125560258__b20421093">CORSConfiguration</strong></p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0125560258__row49572116"><td class="cellrowborder" valign="top" width="29.110000000000003%" headers="mcps1.3.9.3.2.3.1.1 "><p id="EN-US_TOPIC_0125560258__p55918423">ID</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="70.89%" headers="mcps1.3.9.3.2.3.1.2 "><p id="EN-US_TOPIC_0125560258__p33098452">Indicates the unique identifier of a rule. The value can contain a maximum of 255 characters.</p>
|
|
<p id="EN-US_TOPIC_0125560258__p29450615">Type: String</p>
|
|
<p id="EN-US_TOPIC_0125560258__p63728945">Ancestor: Rule</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0125560258__row36689595"><td class="cellrowborder" valign="top" width="29.110000000000003%" headers="mcps1.3.9.3.2.3.1.1 "><p id="EN-US_TOPIC_0125560258__p19067212">AllowedMethod</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="70.89%" headers="mcps1.3.9.3.2.3.1.2 "><p id="EN-US_TOPIC_0125560258__p940305">Indicates a method that is allowed by a CORS rule.</p>
|
|
<p id="EN-US_TOPIC_0125560258__p8462746">Type: String</p>
|
|
<p id="EN-US_TOPIC_0125560258__p9055858">Valid values: <strong id="EN-US_TOPIC_0125560258__b14393865">GET</strong>, <strong id="EN-US_TOPIC_0125560258__b62435929">PUT</strong>, <strong id="EN-US_TOPIC_0125560258__b25052449">HEAD</strong>, <strong id="EN-US_TOPIC_0125560258__b24145451">POST</strong>, and <strong id="EN-US_TOPIC_0125560258__b15982473">DELETE</strong></p>
|
|
<p id="EN-US_TOPIC_0125560258__p9624530">Ancestor: Rule</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0125560258__row19511913"><td class="cellrowborder" valign="top" width="29.110000000000003%" headers="mcps1.3.9.3.2.3.1.1 "><p id="EN-US_TOPIC_0125560258__p36961130">AllowedOrigin</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="70.89%" headers="mcps1.3.9.3.2.3.1.2 "><p id="EN-US_TOPIC_0125560258__p41061555">Indicates an origin that is allowed by a CORS rule. It is a character string and can contain a wildcard (*). Each <strong id="EN-US_TOPIC_0125560258__b34009683">AllowedOrigin</strong> can only contain one wildcard (*).</p>
|
|
<p id="EN-US_TOPIC_0125560258__p37651693">Type: String</p>
|
|
<p id="EN-US_TOPIC_0125560258__p3320924">Ancestor: Rule</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0125560258__row29888320"><td class="cellrowborder" valign="top" width="29.110000000000003%" headers="mcps1.3.9.3.2.3.1.1 "><p id="EN-US_TOPIC_0125560258__p5034835">AllowedHeader</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="70.89%" headers="mcps1.3.9.3.2.3.1.2 "><p id="EN-US_TOPIC_0125560258__p5168462">Indicates an allowed header (<strong id="EN-US_TOPIC_0125560258__b46516162">Access-Control-Request-Headers</strong>) in a CORS request. If a request contains <strong id="EN-US_TOPIC_0125560258__b15992282">Access-Control-Request-Headers</strong>, only a CORS request that matches the configuration of <strong id="EN-US_TOPIC_0125560258__b9712814">AllowedHeader</strong> is considered as a valid request. Each <strong id="EN-US_TOPIC_0125560258__b20306462">AllowedHeader</strong> can only contain one wildcard (*).</p>
|
|
<p id="EN-US_TOPIC_0125560258__p48540437">Type: String</p>
|
|
<p id="EN-US_TOPIC_0125560258__p34210755">Ancestor: Rule</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0125560258__row39461345"><td class="cellrowborder" valign="top" width="29.110000000000003%" headers="mcps1.3.9.3.2.3.1.1 "><p id="EN-US_TOPIC_0125560258__p42252410">MaxAgeSeconds</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="70.89%" headers="mcps1.3.9.3.2.3.1.2 "><p id="EN-US_TOPIC_0125560258__p67002055">Indicates the response time of the CORS that can be cached by a server. It is expressed in seconds.</p>
|
|
<p id="EN-US_TOPIC_0125560258__p66147589">Each <strong id="EN-US_TOPIC_0125560258__b328072572">CORSRule</strong> can contain only one <strong id="EN-US_TOPIC_0125560258__b56354492">MaxAgeSeconds</strong>. It can be set to a negative value.</p>
|
|
<p id="EN-US_TOPIC_0125560258__p37428383">Type: Integer</p>
|
|
<p id="EN-US_TOPIC_0125560258__p1311131">Ancestor: Rule</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0125560258__row11800186"><td class="cellrowborder" valign="top" width="29.110000000000003%" headers="mcps1.3.9.3.2.3.1.1 "><p id="EN-US_TOPIC_0125560258__p16290985">ExposeHeader</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="70.89%" headers="mcps1.3.9.3.2.3.1.2 "><p id="EN-US_TOPIC_0125560258__p44501397">Indicates a supplemented header in CORS responses. The header provides additional information for servers. It cannot contain spaces.</p>
|
|
<p id="EN-US_TOPIC_0125560258__p64968253">Type: String</p>
|
|
<p id="EN-US_TOPIC_0125560258__p47843365">Ancestor: Rule</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560258__section27680879"><h4 class="sectiontitle">Error Responses</h4><p id="EN-US_TOPIC_0125560258__p48312784">For details about other error responses, see <a href="en-us_topic_0125560440.html#EN-US_TOPIC_0125560440__table30733758">Table 1</a>. In addition, this response contains one special error, as described in <a href="#EN-US_TOPIC_0125560258__table45602007">Table 2</a>.</p>
|
|
|
|
<div class="tablenoborder"><a name="EN-US_TOPIC_0125560258__table45602007"></a><a name="table45602007"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0125560258__table45602007" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Special error</caption><thead align="left"><tr id="EN-US_TOPIC_0125560258__row12405700"><th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.10.3.2.4.1.1"><p id="EN-US_TOPIC_0125560258__p65337652">Error Code</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.10.3.2.4.1.2"><p id="EN-US_TOPIC_0125560258__p57858440">Description</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.10.3.2.4.1.3"><p id="EN-US_TOPIC_0125560258__p56022057">HTTP Status Code</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0125560258__row41492734"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.10.3.2.4.1.1 "><p id="EN-US_TOPIC_0125560258__p5468271">NoSuchCORSConfiguration</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.10.3.2.4.1.2 "><p id="EN-US_TOPIC_0125560258__p40276838">Indicates that the CORS configuration of buckets does not exist.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.10.3.2.4.1.3 "><p id="EN-US_TOPIC_0125560258__p41198408">404 Not Found</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560258__section24954142"><h4 class="sectiontitle">Sample Request</h4><pre class="screen" id="EN-US_TOPIC_0125560258__screen6438088512292">GET /?cors HTTP/1.1
|
|
User-Agent: curl/7.19.0 (x86_64-suse-linux-gnu) libcurl/7.19.0 OpenSSL/0.9.8{ zlib/1.2.3 libidn/1.10
|
|
Host: bucketname.obs.example.com
|
|
Accept: */*
|
|
Date: Tue, 28 Apr 2015 09:11:35 +0000
|
|
Authorization: AWS D13E0C94E722DD69423C:FJt2xJ1gEnozLSdpRNTJUoy6344=</pre>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560258__section23260691"><h4 class="sectiontitle">Sample Response</h4><pre class="screen" id="EN-US_TOPIC_0125560258__screen1580524122923">HTTP/1.1 200 OK
|
|
Server: OBS
|
|
x-amz-request-id: C2D7CDD617B33354C3AA227BF2077071
|
|
x-amz-id-2: xO3n8Q4eiJKCeAtG6U4nCSnDzhbBbMhgln8fcrOFYVGRJMc8KK/puQyr5bbSdjBU
|
|
x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc
|
|
Content-Type: application/xml
|
|
Date: Tue, 28 Apr 2015 09:11:35 GMT
|
|
Content-Length: 556
|
|
|
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
<CORSConfiguration xmlns="http://obs.example.com/doc/2015-06-30/">
|
|
<CORSRule>
|
|
<AllowedMethod>POST</AllowedMethod>
|
|
<AllowedMethod>GET</AllowedMethod>
|
|
<AllowedMethod>HEAD</AllowedMethod>
|
|
<AllowedMethod>PUT</AllowedMethod>
|
|
<AllowedMethod>DELETE</AllowedMethod>
|
|
<AllowedOrigin>obs.example.com</AllowedOrigin>
|
|
<AllowedOrigin>www.example.com</AllowedOrigin>
|
|
<AllowedHeader>AllowedHeader_1</AllowedHeader>
|
|
<AllowedHeader>AllowedHeader_2</AllowedHeader>
|
|
<MaxAgeSeconds>100</MaxAgeSeconds>
|
|
<ExposeHeader>ExposeHeader_1</ExposeHeader>
|
|
<ExposeHeader>ExposeHeader_2</ExposeHeader>
|
|
</CORSRule>
|
|
</CORSConfiguration></pre>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="en-us_topic_0125560493.html">Operations on Buckets</a></div>
|
|
</div>
|
|
</div>
|
|
|