forked from docs/doc-exports
Reviewed-by: gtema <artem.goncharov@gmail.com> Co-authored-by: Jawei, Li <lijiawei5@huawei.com> Co-committed-by: Jawei, Li <lijiawei5@huawei.com>
220 lines
14 KiB
HTML
220 lines
14 KiB
HTML
<a name="obs_04_0078"></a><a name="obs_04_0078"></a>
|
|
|
|
<h1 class="topictitle1">OPTIONS Object</h1>
|
|
<div id="body42198271"><div class="section" id="obs_04_0078__section5584184924715"><h4 class="sectiontitle">Functions</h4><p class="msonormal" id="obs_04_0078__p39560887">For details, see <a href="obs_04_0077.html">OPTIONS Bucket</a>.</p>
|
|
</div>
|
|
<div class="section" id="obs_04_0078__section9125142514612"><h4 class="sectiontitle">Differences Between OPTIONS Bucket and OPTIONS Object</h4><p id="obs_04_0078__p92971585546">With the OPTIONS Object, you need to specify an object name in the URL, but an object name is not required with the OPTIONS Bucket, which uses the bucket domain name as the URL. The request lines of the two methods are as follows:</p>
|
|
<pre class="screen" id="obs_04_0078__screen53331759111919">OPTIONS /object HTTP/1.1</pre>
|
|
<pre class="screen" id="obs_04_0078__screen666703202019">OPTIONS / HTTP/1.1</pre>
|
|
</div>
|
|
<div class="section" id="obs_04_0078__section20503664"><h4 class="sectiontitle">Request Syntax</h4><div class="codecoloring" codetype="Xml" id="obs_04_0078__screen26680099"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
6</pre></div></td><td class="code"><div class="highlight"><pre><span></span>OPTIONS /object HTTP/1.1
|
|
Host: bucketname.obs.region.example.com
|
|
Date: date
|
|
Authorization: authorization
|
|
Origin: origin
|
|
Access-Control-Request-Method: method
|
|
</pre></div>
|
|
</td></tr></table></div>
|
|
</div>
|
|
<div class="section" id="obs_04_0078__section50315253"><h4 class="sectiontitle">Request Parameters</h4><p class="msonormal" id="obs_04_0078__p51217154">This request contains no parameter.</p>
|
|
</div>
|
|
<div class="section" id="obs_04_0078__section50184093"><h4 class="sectiontitle">Request Headers</h4><p class="msonormal" id="obs_04_0078__p54948847"><a href="#obs_04_0078__table39180475205737">Table 1</a> describes headers used by this request.</p>
|
|
|
|
<div class="tablenoborder"><a name="obs_04_0078__table39180475205737"></a><a name="table39180475205737"></a><table cellpadding="4" cellspacing="0" summary="" id="obs_04_0078__table39180475205737" frame="border" border="1" rules="all"><caption><b>Table 1 </b>OPTIONS request headers</caption><thead align="left"><tr id="obs_04_0078__row43151909"><th align="left" class="cellrowborder" valign="top" width="19.387755102040817%" id="mcps1.3.5.3.2.4.1.1"><p id="obs_04_0078__p5643772">Header</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="63.26530612244898%" id="mcps1.3.5.3.2.4.1.2"><p id="obs_04_0078__p54492350">Description</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="17.346938775510203%" id="mcps1.3.5.3.2.4.1.3"><p id="obs_04_0078__p51804245">Mandatory</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="obs_04_0078__row35394345"><td class="cellrowborder" valign="top" width="19.387755102040817%" headers="mcps1.3.5.3.2.4.1.1 "><p id="obs_04_0078__p48369697">Origin</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="63.26530612244898%" headers="mcps1.3.5.3.2.4.1.2 "><p id="obs_04_0078__p25631398">Origin of the cross-domain request specified by the pre-request. Generally, it is a domain name set in CORS.</p>
|
|
<p id="obs_04_0078__p29355992">Type: string</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.346938775510203%" headers="mcps1.3.5.3.2.4.1.3 "><p id="obs_04_0078__p29025179">Yes</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="obs_04_0078__row59900021"><td class="cellrowborder" valign="top" width="19.387755102040817%" headers="mcps1.3.5.3.2.4.1.1 "><p id="obs_04_0078__p20063503">Access-Control-Request-Method</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="63.26530612244898%" headers="mcps1.3.5.3.2.4.1.2 "><p id="obs_04_0078__p14531029">Indicates an HTTP method that can be used by a request. The request can use multiple method headers.</p>
|
|
<p id="obs_04_0078__p63670405">Type: string</p>
|
|
<p id="obs_04_0078__p36162737">Valid values: <strong id="obs_04_0078__b2404182382918">GET</strong>, <strong id="obs_04_0078__b114901525132914">PUT</strong>, <strong id="obs_04_0078__b6599172820290">HEAD</strong>, <strong id="obs_04_0078__b1515430112913">POST</strong>, and <strong id="obs_04_0078__b1743620344297">DELETE</strong>. </p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.346938775510203%" headers="mcps1.3.5.3.2.4.1.3 "><p id="obs_04_0078__p43500552">Yes</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="obs_04_0078__row55960654"><td class="cellrowborder" valign="top" width="19.387755102040817%" headers="mcps1.3.5.3.2.4.1.1 "><p id="obs_04_0078__p36519148">Access-Control-Request-Headers</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="63.26530612244898%" headers="mcps1.3.5.3.2.4.1.2 "><p id="obs_04_0078__p5260986">Indicates the HTTP headers of a request. The request can use multiple HTTP headers.</p>
|
|
<p id="obs_04_0078__p47348874">Type: string</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.346938775510203%" headers="mcps1.3.5.3.2.4.1.3 "><p id="obs_04_0078__p10053604">No</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="obs_04_0078__section49003659"><h4 class="sectiontitle">Request Elements</h4><p class="msonormal" id="obs_04_0078__p9035586">This request involves no elements.</p>
|
|
</div>
|
|
<div class="section" id="obs_04_0078__section38379751"><h4 class="sectiontitle">Response Syntax</h4><div class="codecoloring" codetype="Xml" id="obs_04_0078__screen60793869"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
|
8
|
|
9</pre></div></td><td class="code"><div class="highlight"><pre><span></span>HTTP/1.1 status_code
|
|
Content-Type: type
|
|
Access-Control-Allow-Origin: origin
|
|
Access-Control-Allow-Methods: method
|
|
Access-Control-Allow-Header: header
|
|
Access-Control-Max-Age: time
|
|
Access-Control-Expose-Headers: header
|
|
Date: date
|
|
Content-Length: length
|
|
</pre></div>
|
|
</td></tr></table></div>
|
|
</div>
|
|
<div class="section" id="obs_04_0078__section9873442"><h4 class="sectiontitle">Response Headers</h4><p class="msonormal" id="obs_04_0078__p36565252">The request uses the headers described in <a href="#obs_04_0078__table14690348205823">Table 2</a>.</p>
|
|
|
|
<div class="tablenoborder"><a name="obs_04_0078__table14690348205823"></a><a name="table14690348205823"></a><table cellpadding="4" cellspacing="0" summary="" id="obs_04_0078__table14690348205823" frame="border" border="1" rules="all"><caption><b>Table 2 </b>CORS request headers</caption><thead align="left"><tr id="obs_04_0078__row37872586"><th align="left" class="cellrowborder" valign="top" width="28.28282828282828%" id="mcps1.3.8.3.2.3.1.1"><p id="obs_04_0078__p47780665">Header</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="71.71717171717171%" id="mcps1.3.8.3.2.3.1.2"><p id="obs_04_0078__p45028689">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="obs_04_0078__row23445177"><td class="cellrowborder" valign="top" width="28.28282828282828%" headers="mcps1.3.8.3.2.3.1.1 "><p id="obs_04_0078__p20011161">Access-Control-Allow-Origin</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="71.71717171717171%" headers="mcps1.3.8.3.2.3.1.2 "><p id="obs_04_0078__p10291354">If the origin of a request meets server CORS configuration requirements, the response contains the origin.</p>
|
|
<p id="obs_04_0078__p25513326">Type: string</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="obs_04_0078__row28293347"><td class="cellrowborder" valign="top" width="28.28282828282828%" headers="mcps1.3.8.3.2.3.1.1 "><p id="obs_04_0078__p10059805">Access-Control-Allow-Headers</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="71.71717171717171%" headers="mcps1.3.8.3.2.3.1.2 "><p id="obs_04_0078__p9537904">If the headers of a request meet server CORS configuration requirements, the response contains the headers.</p>
|
|
<p id="obs_04_0078__p18732274">Type: string</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="obs_04_0078__row34372739"><td class="cellrowborder" valign="top" width="28.28282828282828%" headers="mcps1.3.8.3.2.3.1.1 "><p id="obs_04_0078__p32728446">Access-Control-Max-Age</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="71.71717171717171%" headers="mcps1.3.8.3.2.3.1.2 "><p id="obs_04_0078__p33758474">Value of MaxAgeSeconds in the CORS configuration of a server.</p>
|
|
<p id="obs_04_0078__p35390814">Type: integer</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="obs_04_0078__row50081870"><td class="cellrowborder" valign="top" width="28.28282828282828%" headers="mcps1.3.8.3.2.3.1.1 "><p id="obs_04_0078__p30099699">Access-Control-Allow-Methods</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="71.71717171717171%" headers="mcps1.3.8.3.2.3.1.2 "><p id="obs_04_0078__p22156577">If the Access-Control-Request-Method of a request meets server CORS configuration requirements, the response contains the methods in the rule.</p>
|
|
<p id="obs_04_0078__p65191466">Type: string</p>
|
|
<p id="obs_04_0078__p49852287">Possible values are GET, PUT, HEAD, POST, and DELETE. </p>
|
|
</td>
|
|
</tr>
|
|
<tr id="obs_04_0078__row46017399"><td class="cellrowborder" valign="top" width="28.28282828282828%" headers="mcps1.3.8.3.2.3.1.1 "><p id="obs_04_0078__p36421857">Access-Control-Expose-Headers</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="71.71717171717171%" headers="mcps1.3.8.3.2.3.1.2 "><p id="obs_04_0078__p64489295">Indicates ExposeHeader in the CORS configuration of a server.</p>
|
|
<p id="obs_04_0078__p43532747">Type: string</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="obs_04_0078__section21752117"><h4 class="sectiontitle">Response Elements</h4><p class="msonormal" id="obs_04_0078__p36491643">This response involves no elements.</p>
|
|
</div>
|
|
<div class="section" id="obs_04_0078__section61551329"><h4 class="sectiontitle">Error Responses</h4><p class="msonormal" id="obs_04_0078__p3033124"><a href="#obs_04_0078__table38908138205823">Table 3</a> describes possible special errors in the request.</p>
|
|
|
|
<div class="tablenoborder"><a name="obs_04_0078__table38908138205823"></a><a name="table38908138205823"></a><table cellpadding="4" cellspacing="0" summary="" id="obs_04_0078__table38908138205823" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Special error</caption><thead align="left"><tr id="obs_04_0078__row31266288"><th align="left" class="cellrowborder" valign="top" width="26.53061224489796%" id="mcps1.3.10.3.2.4.1.1"><p id="obs_04_0078__p49541410">Error Code</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="48.97959183673469%" id="mcps1.3.10.3.2.4.1.2"><p id="obs_04_0078__p53431297">Description</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="24.489795918367346%" id="mcps1.3.10.3.2.4.1.3"><p id="obs_04_0078__p32967796">HTTP Status Code</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="obs_04_0078__row53145828"><td class="cellrowborder" valign="top" width="26.53061224489796%" headers="mcps1.3.10.3.2.4.1.1 "><p id="obs_04_0078__p9844792">Bad Request</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="48.97959183673469%" headers="mcps1.3.10.3.2.4.1.2 "><p id="obs_04_0078__p59230681">Invalid Access-Control-Request-Method: null</p>
|
|
<p id="obs_04_0078__p63314081">When CORS and OPTIONS are configured for a bucket, no method header is added.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="24.489795918367346%" headers="mcps1.3.10.3.2.4.1.3 "><p id="obs_04_0078__p28166943">400 BadRequest</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="obs_04_0078__row52175903"><td class="cellrowborder" valign="top" width="26.53061224489796%" headers="mcps1.3.10.3.2.4.1.1 "><p id="obs_04_0078__p65498646">Bad Request</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="48.97959183673469%" headers="mcps1.3.10.3.2.4.1.2 "><p id="obs_04_0078__p3790072">Insufficient information. Origin request header needed.</p>
|
|
<p id="obs_04_0078__p34110654">When CORS and OPTIONS are configured for a bucket, no origin header is added.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="24.489795918367346%" headers="mcps1.3.10.3.2.4.1.3 "><p id="obs_04_0078__p11499566">400 BadRequest</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="obs_04_0078__row36387235"><td class="cellrowborder" valign="top" width="26.53061224489796%" headers="mcps1.3.10.3.2.4.1.1 "><p id="obs_04_0078__p61684923">AccessForbidden</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="48.97959183673469%" headers="mcps1.3.10.3.2.4.1.2 "><p id="obs_04_0078__p30422880">CORSResponse: This CORS request is not allowed. This is usually because the evaluation of Origin, request method/Access-Control-Request-Method or Access-Control-Request-Headers are not whitelisted by the resource's CORS spec.</p>
|
|
<p id="obs_04_0078__p5370466">When CORS and OPTIONS are configured for a bucket, origin, method, and headers do not match any rule.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="24.489795918367346%" headers="mcps1.3.10.3.2.4.1.3 "><p id="obs_04_0078__p32354629">403 Forbidden</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p class="msonormal" id="obs_04_0078__p22756207">For other errors, see <a href="obs_04_0115.html#obs_04_0115__d0e843">Table 2</a>.</p>
|
|
</div>
|
|
<div class="section" id="obs_04_0078__section14482163815396"><h4 class="sectiontitle">Sample Request</h4><div class="codecoloring" codetype="Xml" id="obs_04_0078__screen8484163863919"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
|
8</pre></div></td><td class="code"><div class="highlight"><pre><span></span>OPTIONS /object_1 HTTP/1.1
|
|
User-Agent: curl/7.29.0
|
|
Host: examplebucket.obs.region.example.com
|
|
Accept: */*
|
|
Date: WED, 01 Jul 2015 04:02:19 GMT
|
|
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:bQZG9c2aokAJsHOOkuVBK6cHZZQ=
|
|
Origin: www.example.com
|
|
Access-Control-Request-Method: PUT
|
|
</pre></div>
|
|
</td></tr></table></div>
|
|
</div>
|
|
<div class="section" id="obs_04_0078__section76081155815"><h4 class="sectiontitle">Sample Response</h4><div class="codecoloring" codetype="Xml" id="obs_04_0078__screen8485113814"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
|
8
|
|
9
|
|
10
|
|
11</pre></div></td><td class="code"><div class="highlight"><pre><span></span>HTTP/1.1 200 OK
|
|
Server: OBS
|
|
x-obs-request-id: BF26000001643632D12EFCE1C1294555
|
|
Access-Control-Allow-Origin: www.example.com
|
|
Access-Control-Allow-Methods: POST,GET,HEAD,PUT,DELETE
|
|
Access-Control-Max-Age: 100
|
|
Access-Control-Expose-Headers: ExposeHeader_1,ExposeHeader_2
|
|
Access-Control-Allow-Credentials: true
|
|
x-obs-id-2: 32AAAQAAEAABAAAQAAEAABAAAQAAEAABCS+DXV4zZetbTqFehhEcuXywTa/mi3T3
|
|
Date: WED, 01 Jul 2015 04:02:19 GMT
|
|
Content-Length: 0
|
|
</pre></div>
|
|
</td></tr></table></div>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="obs_04_0070.html">Static Website Hosting</a></div>
|
|
</div>
|
|
</div>
|
|
|