doc-exports/docs/obs/s3api/en-us_topic_0125560261.html
Jawei, Li 1a4c1a720a OBS s3api 2.0.38.SP5
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
Co-authored-by: Jawei, Li <lijiawei5@huawei.com>
Co-committed-by: Jawei, Li <lijiawei5@huawei.com>
2022-11-16 14:51:13 +00:00

194 lines
15 KiB
HTML

<a name="EN-US_TOPIC_0125560261"></a><a name="EN-US_TOPIC_0125560261"></a>
<h1 class="topictitle1">OPTIONS Object</h1>
<div id="body34692896"><p id="EN-US_TOPIC_0125560261__p50034027">For details, see section <a href="en-us_topic_0125560464.html">OPTIONS Bucket</a>.</p>
<div class="section" id="EN-US_TOPIC_0125560261__section54969651"><h4 class="sectiontitle">Request Syntax</h4><pre class="screen" id="EN-US_TOPIC_0125560261__screen2086068114924">OPTIONS /object HTTP/1.1
User-Agent: agent
Host: bucketname.obs.example.com
Accept: */*
Date: date
Authorization: authorization
Origin: origin
Access-Control-Request-Method: method</pre>
</div>
<div class="section" id="EN-US_TOPIC_0125560261__section24964816"><h4 class="sectiontitle">Request Parameters</h4><p id="EN-US_TOPIC_0125560261__p65363170">This request involves no parameters.</p>
</div>
<div class="section" id="EN-US_TOPIC_0125560261__section23356753"><h4 class="sectiontitle">Request Headers</h4><p id="EN-US_TOPIC_0125560261__p59925403"><a href="#EN-US_TOPIC_0125560261__table58188993">Table 1</a> lists the request headers.</p>
<div class="tablenoborder"><a name="EN-US_TOPIC_0125560261__table58188993"></a><a name="table58188993"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0125560261__table58188993" frame="border" border="1" rules="all"><caption><b>Table 1 </b>OPTIONS request headers</caption><thead align="left"><tr id="EN-US_TOPIC_0125560261__row32819733"><th align="left" class="cellrowborder" valign="top" width="28.02280228022802%" id="mcps1.3.4.3.2.4.1.1"><p id="EN-US_TOPIC_0125560261__p41152746">Header</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="38.64386438643865%" id="mcps1.3.4.3.2.4.1.2"><p id="EN-US_TOPIC_0125560261__p45038152">Description</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.4.3.2.4.1.3"><p id="EN-US_TOPIC_0125560261__p24211670">Remarks</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0125560261__row14988220"><td class="cellrowborder" valign="top" width="28.02280228022802%" headers="mcps1.3.4.3.2.4.1.1 "><p id="EN-US_TOPIC_0125560261__p6086307">Origin</p>
</td>
<td class="cellrowborder" valign="top" width="38.64386438643865%" headers="mcps1.3.4.3.2.4.1.2 "><p id="EN-US_TOPIC_0125560261__p23228850">Indicates an origin specified by a pre-request. Generally, it is a domain name.</p>
<p id="EN-US_TOPIC_0125560261__p7733065">Type: String</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.4.3.2.4.1.3 "><p id="EN-US_TOPIC_0125560261__p22398504">Mandatory</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0125560261__row259947"><td class="cellrowborder" valign="top" width="28.02280228022802%" headers="mcps1.3.4.3.2.4.1.1 "><p id="EN-US_TOPIC_0125560261__p21055716">Access-Control-Request-Method</p>
</td>
<td class="cellrowborder" valign="top" width="38.64386438643865%" headers="mcps1.3.4.3.2.4.1.2 "><p id="EN-US_TOPIC_0125560261__p27791397">Indicates an HTTP method that can be used by a request. The request can use multiple method headers.</p>
<p id="EN-US_TOPIC_0125560261__p48795984">Type: String</p>
<p id="EN-US_TOPIC_0125560261__p36510679">Valid values: <strong id="EN-US_TOPIC_0125560261__b60160657">GET</strong>, <strong id="EN-US_TOPIC_0125560261__b4575009">PUT</strong>, <strong id="EN-US_TOPIC_0125560261__b41175087">HEAD</strong>, <strong id="EN-US_TOPIC_0125560261__b35031468">POST</strong>, and <strong id="EN-US_TOPIC_0125560261__b46847761">DELETE</strong></p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.4.3.2.4.1.3 "><p id="EN-US_TOPIC_0125560261__p36572320">Mandatory</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0125560261__row60715427"><td class="cellrowborder" valign="top" width="28.02280228022802%" headers="mcps1.3.4.3.2.4.1.1 "><p id="EN-US_TOPIC_0125560261__p19002592">Access-Control-Request-Headers</p>
</td>
<td class="cellrowborder" valign="top" width="38.64386438643865%" headers="mcps1.3.4.3.2.4.1.2 "><p id="EN-US_TOPIC_0125560261__p62814973">Indicates the HTTP headers of a request. The request can use multiple HTTP headers.</p>
<p id="EN-US_TOPIC_0125560261__p28463847">Type: String</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.4.3.2.4.1.3 "><p id="EN-US_TOPIC_0125560261__p23870264">Optional</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0125560261__row3353184244011"><td class="cellrowborder" valign="top" width="28.02280228022802%" headers="mcps1.3.4.3.2.4.1.1 "><p id="EN-US_TOPIC_0125560261__p7527144324018">x-amz-security-token</p>
</td>
<td class="cellrowborder" valign="top" width="38.64386438643865%" headers="mcps1.3.4.3.2.4.1.2 "><p id="EN-US_TOPIC_0125560261__p19527124310403">Header field used to identify the request of a federated user. When the federal authentication function is enabled, users sending such requests are identified as federated users.</p>
<p id="EN-US_TOPIC_0125560261__p1852713433401">Type: string</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.4.3.2.4.1.3 "><p id="EN-US_TOPIC_0125560261__p18527843164011">Optional. This parameter must be carried in the request sent by federated users.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0125560261__section8884193"><h4 class="sectiontitle">Request Elements</h4><p id="EN-US_TOPIC_0125560261__p20226726">This request involves no elements.</p>
</div>
<div class="section" id="EN-US_TOPIC_0125560261__section18040105"><h4 class="sectiontitle">Response Syntax</h4><pre class="screen" id="EN-US_TOPIC_0125560261__screen63023660114940">HTTP/1.1 status_code
Server: server
x-amz-request-id: request id
x-amz-id-2: id
Content-Type: type
Access-Control-Allow-Origin: origin
Access-Control-Allow-Methods: method
Access-Control-Allow-Header: header
Access-Control-Max-Age: seconds
Access-Control-Expose-Headers: header
Date: date
Content-Length: length</pre>
</div>
<div class="section" id="EN-US_TOPIC_0125560261__section28143222"><h4 class="sectiontitle">Response Headers</h4><p id="EN-US_TOPIC_0125560261__p32019281"><a href="#EN-US_TOPIC_0125560261__table47822814">Table 2</a> lists the request headers.</p>
<div class="tablenoborder"><a name="EN-US_TOPIC_0125560261__table47822814"></a><a name="table47822814"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0125560261__table47822814" frame="border" border="1" rules="all"><caption><b>Table 2 </b>CORS request headers</caption><thead align="left"><tr id="EN-US_TOPIC_0125560261__row18565881"><th align="left" class="cellrowborder" valign="top" width="33.82%" id="mcps1.3.7.3.2.3.1.1"><p id="EN-US_TOPIC_0125560261__p27441378">Header</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="66.18%" id="mcps1.3.7.3.2.3.1.2"><p id="EN-US_TOPIC_0125560261__p8159144">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0125560261__row56910898"><td class="cellrowborder" valign="top" width="33.82%" headers="mcps1.3.7.3.2.3.1.1 "><p id="EN-US_TOPIC_0125560261__p46380008">Access-Control-Allow-Origin</p>
</td>
<td class="cellrowborder" valign="top" width="66.18%" headers="mcps1.3.7.3.2.3.1.2 "><p id="EN-US_TOPIC_0125560261__p65793204">If the origin of a request meets server CORS configuration requirements, the response contains the origin.</p>
<p id="EN-US_TOPIC_0125560261__p55267924">Type: String</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0125560261__row27649275"><td class="cellrowborder" valign="top" width="33.82%" headers="mcps1.3.7.3.2.3.1.1 "><p id="EN-US_TOPIC_0125560261__p24998823">Access-Control-Allow-Headers</p>
</td>
<td class="cellrowborder" valign="top" width="66.18%" headers="mcps1.3.7.3.2.3.1.2 "><p id="EN-US_TOPIC_0125560261__p11638816">If the headers of a request meet server CORS configuration requirements, the response contains the headers.</p>
<p id="EN-US_TOPIC_0125560261__p37640485">Type: String</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0125560261__row3220045"><td class="cellrowborder" valign="top" width="33.82%" headers="mcps1.3.7.3.2.3.1.1 "><p id="EN-US_TOPIC_0125560261__p59497111">Access-Control-Max-Age</p>
</td>
<td class="cellrowborder" valign="top" width="66.18%" headers="mcps1.3.7.3.2.3.1.2 "><p id="EN-US_TOPIC_0125560261__p54536677">Indicates <strong id="EN-US_TOPIC_0125560261__b114731030191815">MaxAgeSeconds</strong> in the CORS configuration of a server.</p>
<p id="EN-US_TOPIC_0125560261__p55394720">Type: Integer</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0125560261__row28790433"><td class="cellrowborder" valign="top" width="33.82%" headers="mcps1.3.7.3.2.3.1.1 "><p id="EN-US_TOPIC_0125560261__p50323754">Access-Control-Allow-Methods</p>
</td>
<td class="cellrowborder" valign="top" width="66.18%" headers="mcps1.3.7.3.2.3.1.2 "><p id="EN-US_TOPIC_0125560261__p49692243">If the <strong id="EN-US_TOPIC_0125560261__b44577003">Access-Control-Request-Method</strong> of a request meets server CORS configuration requirements, the response contains the methods in the rule.</p>
<p id="EN-US_TOPIC_0125560261__p65648708">Type: String</p>
<p id="EN-US_TOPIC_0125560261__p53967463">Valid values: <strong id="EN-US_TOPIC_0125560261__b15945126">GET</strong>, <strong id="EN-US_TOPIC_0125560261__b9288408">PUT</strong>, <strong id="EN-US_TOPIC_0125560261__b16486816">HEAD</strong>, <strong id="EN-US_TOPIC_0125560261__b14163622">POST</strong>, and <strong id="EN-US_TOPIC_0125560261__b60363739">DELETE</strong></p>
</td>
</tr>
<tr id="EN-US_TOPIC_0125560261__row6402744"><td class="cellrowborder" valign="top" width="33.82%" headers="mcps1.3.7.3.2.3.1.1 "><p id="EN-US_TOPIC_0125560261__p48860279">Access-Control-Expose-Headers</p>
</td>
<td class="cellrowborder" valign="top" width="66.18%" headers="mcps1.3.7.3.2.3.1.2 "><p id="EN-US_TOPIC_0125560261__p65368522">Indicates <strong id="EN-US_TOPIC_0125560261__b51445791">ExposeHeader</strong> in the CORS configuration of a server.</p>
<p id="EN-US_TOPIC_0125560261__p60358938">Type: String</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0125560261__section51962411"><h4 class="sectiontitle">Response Elements</h4><p id="EN-US_TOPIC_0125560261__p45360065">This response involves no elements.</p>
</div>
<div class="section" id="EN-US_TOPIC_0125560261__section65008522"><h4 class="sectiontitle">Error Responses</h4><p id="EN-US_TOPIC_0125560261__p50286663"><a href="#EN-US_TOPIC_0125560261__table27752149">Table 3</a> describes possible special errors in the request.</p>
<div class="tablenoborder"><a name="EN-US_TOPIC_0125560261__table27752149"></a><a name="table27752149"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0125560261__table27752149" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Special errors</caption><thead align="left"><tr id="EN-US_TOPIC_0125560261__row804613"><th align="left" class="cellrowborder" valign="top" width="25.072507250725067%" id="mcps1.3.9.3.2.4.1.1"><p id="EN-US_TOPIC_0125560261__p65173721">Error Code</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="45.82458245824582%" id="mcps1.3.9.3.2.4.1.2"><p id="EN-US_TOPIC_0125560261__p44580049">Description</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="29.1029102910291%" id="mcps1.3.9.3.2.4.1.3"><p id="EN-US_TOPIC_0125560261__p54214230">HTTP Status Code</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0125560261__row29276495"><td class="cellrowborder" valign="top" width="25.072507250725067%" headers="mcps1.3.9.3.2.4.1.1 "><p id="EN-US_TOPIC_0125560261__p22585893">Bad Request</p>
</td>
<td class="cellrowborder" valign="top" width="45.82458245824582%" headers="mcps1.3.9.3.2.4.1.2 "><p id="EN-US_TOPIC_0125560261__p17518015">Invalid Access-Control-Request-Method: null</p>
<p id="EN-US_TOPIC_0125560261__p23444409">When CORS and OPTIONS are configured for a bucket, no method header is added.</p>
</td>
<td class="cellrowborder" valign="top" width="29.1029102910291%" headers="mcps1.3.9.3.2.4.1.3 "><p id="EN-US_TOPIC_0125560261__p19948981">400 Bad Request</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0125560261__row45323105"><td class="cellrowborder" valign="top" width="25.072507250725067%" headers="mcps1.3.9.3.2.4.1.1 "><p id="EN-US_TOPIC_0125560261__p47292856">Bad Request</p>
</td>
<td class="cellrowborder" valign="top" width="45.82458245824582%" headers="mcps1.3.9.3.2.4.1.2 "><p id="EN-US_TOPIC_0125560261__p5516148">Insufficient information. Origin request header needed.</p>
<p id="EN-US_TOPIC_0125560261__p49645340">When CORS and OPTIONS are configured for a bucket, no origin header is added.</p>
</td>
<td class="cellrowborder" valign="top" width="29.1029102910291%" headers="mcps1.3.9.3.2.4.1.3 "><p id="EN-US_TOPIC_0125560261__p61849578">400 Bad Request</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0125560261__row19775290"><td class="cellrowborder" valign="top" width="25.072507250725067%" headers="mcps1.3.9.3.2.4.1.1 "><p id="EN-US_TOPIC_0125560261__p58294676">AccessForbidden</p>
</td>
<td class="cellrowborder" valign="top" width="45.82458245824582%" headers="mcps1.3.9.3.2.4.1.2 "><p id="EN-US_TOPIC_0125560261__p24248306">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="EN-US_TOPIC_0125560261__p16908166">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="29.1029102910291%" headers="mcps1.3.9.3.2.4.1.3 "><p id="EN-US_TOPIC_0125560261__p27384230">403 Forbidden</p>
</td>
</tr>
</tbody>
</table>
</div>
<p id="EN-US_TOPIC_0125560261__p3530175">For details about other errors, see <a href="en-us_topic_0125560440.html#EN-US_TOPIC_0125560440__table30733758">Table 1</a>.</p>
</div>
<div class="section" id="EN-US_TOPIC_0125560261__section15592595"><h4 class="sectiontitle">Sample Request</h4><pre class="screen" id="EN-US_TOPIC_0125560261__screen1014320211500">OPTIONS /object 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 12:44:17 +0000
Authorization: AWS D13E0C94E722DD69423C:9U2ZGZebzPsbjsbxd6Qx1552LCI=
Origin:www.example.com
Access-Control-Request-Method:HEAD
Access-Control-Request-Headers:acc_header_1
Access-Control-Request-Headers:acc_header_2</pre>
</div>
<div class="section" id="EN-US_TOPIC_0125560261__section6115634"><h4 class="sectiontitle">Sample Response</h4><pre class="screen" id="EN-US_TOPIC_0125560261__screen44826156115013">HTTP/1.1 200 OK
Server: OBS
x-amz-request-id: EB916A17C4CA9863E10CB3875D12D921
x-amz-id-2: xuXo/62YzJOvNjQ3179xVyqlTSY8cWbI/EBDbKmhEoqdvKw7bU4KwFzeBX9oq212
x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc
Content-Type: text/xml
Access-Control-Allow-Origin: www.example.com
Access-Control-Allow-Methods: POST,GET,HEAD,PUT
Access-Control-Allow-Headers: acc_header_1,acc_header_2
Access-Control-Max-Age: 100
Access-Control-Expose-Headers: exp_header_1
Date: Tue, 28 Apr 2015 12:46:56 GMT
Content-Length: 0</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="en-us_topic_0125560489.html">Operations on Objects</a></div>
</div>
</div>