doc-exports/docs/obs/api-ref/obs_04_0072.html
Jawei, Li f1cb839979 OBS api-ref 2.0.38.SP5
Reviewed-by: gtema <artem.goncharov@gmail.com>
Co-authored-by: Jawei, Li <lijiawei5@huawei.com>
Co-committed-by: Jawei, Li <lijiawei5@huawei.com>
2022-11-03 11:54:51 +00:00

122 lines
7.3 KiB
HTML

<a name="obs_04_0072"></a><a name="obs_04_0072"></a>
<h1 class="topictitle1">Obtaining the Static Website Hosting Configuration of a Bucket</h1>
<div id="body30395827"><div class="section" id="obs_04_0072__section5584184924715"><h4 class="sectiontitle">Functions</h4><p class="msonormal" id="obs_04_0072__p56290971">You can perform this operation to get the static website hosting configuration of a bucket.</p>
<p class="msonormal" id="obs_04_0072__p36856693">To perform this operation, you must have the <strong id="obs_04_0072__b852412521206">GetBucketWebsite</strong> permission. By default, only the bucket owner can perform this operation. The bucket owner can grant the permission to other users by configuring the bucket policy or user policy.</p>
</div>
<div class="section" id="obs_04_0072__section63274784"><h4 class="sectiontitle">Request Syntax</h4><div class="codecoloring" codetype="Xml" id="obs_04_0072__screen46142899"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
2
3
4</pre></div></td><td class="code"><div class="highlight"><pre><span></span>GET /?website HTTP/1.1
Host: bucketname.obs.region.example.com
Date: date
Authorization: authorization
</pre></div>
</td></tr></table></div>
</div>
<div class="section" id="obs_04_0072__section32602150"><h4 class="sectiontitle">Request Parameters</h4><p class="msonormal" id="obs_04_0072__p20996874">This request contains no parameter.</p>
</div>
<div class="section" id="obs_04_0072__section24983894"><h4 class="sectiontitle">Request Headers</h4><p class="msonormal" id="obs_04_0072__p23025213">This request uses common headers. For details, see <a href="obs_04_0007.html#obs_04_0007__table25197309">Table 3</a>.</p>
</div>
<div class="section" id="obs_04_0072__section23528459"><h4 class="sectiontitle">Request Elements</h4><p class="msonormal" id="obs_04_0072__p8164380">This request involves no elements.</p>
</div>
<div class="section" id="obs_04_0072__section10429540"><h4 class="sectiontitle">Response Syntax</h4><div class="codecoloring" codetype="Xml" id="obs_04_0072__screen57335080"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
2
3
4
5
6
7
8
9
10</pre></div></td><td class="code"><div class="highlight"><pre><span></span>HTTP/1.1 status_code
Date: date
Content-Type: type
Content-Length: length
<span class="cp">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;</span>
<span class="nt">&lt;WebsiteConfiguration</span> <span class="na">xmlns=</span><span class="s">&quot;http://obs.region.example.com/doc/2015-06-30/&quot;</span><span class="nt">&gt;</span>
<span class="nt">&lt;RedirectAllRequestsTo&gt;</span>
<span class="nt">&lt;HostName&gt;</span>hostName<span class="nt">&lt;/HostName&gt;</span>
<span class="nt">&lt;/RedirectAllRequestsTo&gt;</span>
<span class="nt">&lt;/WebsiteConfiguration&gt;</span>
</pre></div>
</td></tr></table></div>
</div>
<div class="section" id="obs_04_0072__section26757004"><h4 class="sectiontitle">Response Headers</h4><p class="msonormal" id="obs_04_0072__p1512332591013">The response to the request uses common headers. For details, see <a href="obs_04_0013.html#obs_04_0013__d0e686">Table 1</a>.</p>
</div>
<div class="section" id="obs_04_0072__section39486451"><h4 class="sectiontitle">Response Elements</h4><p class="msonormal" id="obs_04_0072__p63339175">This response contains elements the same as those used by the PutBucketWebsite request. For details, see <a href="obs_04_0071.html#obs_04_0071__section12388580153122">Request Elements</a>.</p>
</div>
<div class="section" id="obs_04_0072__section19833747"><h4 class="sectiontitle">Error Responses</h4><p class="msonormal" id="obs_04_0072__p3360155"><a href="#obs_04_0072__table12494839144020">Table 1</a> describes possible special errors in this request.</p>
<div class="tablenoborder"><a name="obs_04_0072__table12494839144020"></a><a name="table12494839144020"></a><table cellpadding="4" cellspacing="0" summary="" id="obs_04_0072__table12494839144020" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Special error</caption><thead align="left"><tr id="obs_04_0072__row29840902"><th align="left" class="cellrowborder" valign="top" width="39.795918367346935%" id="mcps1.3.9.3.2.4.1.1"><p id="obs_04_0072__p1194035">Error Code</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="35.714285714285715%" id="mcps1.3.9.3.2.4.1.2"><p id="obs_04_0072__p29608000">Description</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="24.489795918367346%" id="mcps1.3.9.3.2.4.1.3"><p id="obs_04_0072__p49437781">HTTP Status Code</p>
</th>
</tr>
</thead>
<tbody><tr id="obs_04_0072__row45037339"><td class="cellrowborder" valign="top" width="39.795918367346935%" headers="mcps1.3.9.3.2.4.1.1 "><p id="obs_04_0072__p24145849">NoSuchWebsiteConfiguration</p>
</td>
<td class="cellrowborder" valign="top" width="35.714285714285715%" headers="mcps1.3.9.3.2.4.1.2 "><p id="obs_04_0072__p9656792">The website configuration does not exist.</p>
</td>
<td class="cellrowborder" valign="top" width="24.489795918367346%" headers="mcps1.3.9.3.2.4.1.3 "><p id="obs_04_0072__p44002720">404 Not Found</p>
</td>
</tr>
</tbody>
</table>
</div>
<p class="msonormal" id="obs_04_0072__p60480162">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_0072__section14482163815396"><h4 class="sectiontitle">Sample Request</h4><div class="codecoloring" codetype="Xml" id="obs_04_0072__screen8484163863919"><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>GET /?website HTTP/1.1
User-Agent: curl/7.29.0
Host: examplebucket.obs.region.example.com
Accept: */*
Date: WED, 01 Jul 2015 03:41:54 GMT
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:Yxt1Ru+feHE0S94R7dcBp+hfLnI=
</pre></div>
</td></tr></table></div>
</div>
<div class="section" id="obs_04_0072__section76081155815"><h4 class="sectiontitle">Sample Response</h4><div class="codecoloring" codetype="Xml" id="obs_04_0072__screen8485113814"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
2
3
4
5
6
7
8
9
10
11
12
13
14</pre></div></td><td class="code"><div class="highlight"><pre><span></span>HTTP/1.1 200 OK
Server: OBS
x-obs-request-id: BF2600000164363442EC03A8CA3DD7F5
x-obs-id-2: 32AAAQAAEAABAAAQAAEAABAAAQAAEAABCSFbGOmlN0BVp1kbwN3har8jbVvtKEKN
Content-Type: application/xml
Date: WED, 01 Jul 2015 03:41:54 GMT
Content-Length: 250
<span class="cp">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;</span>
<span class="nt">&lt;WebsiteConfiguration</span> <span class="na">xmlns=</span><span class="s">&quot;http://obs.region.example.com/doc/2015-06-30/&quot;</span><span class="nt">&gt;</span>
<span class="nt">&lt;RedirectAllRequestsTo&gt;</span>
<span class="nt">&lt;HostName&gt;</span>www.example.com<span class="nt">&lt;/HostName&gt;</span>
<span class="nt">&lt;/RedirectAllRequestsTo&gt;</span>
<span class="nt">&lt;/WebsiteConfiguration&gt;</span>
</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>