GET Bucket Website
更新時間 2024-10-10 18:44:13
最近更新時間: 2024-10-10 18:44:13
分享文章
本節主要介紹GET Bucket Website。
此操作用來獲得指定Bucket的website。只有根用戶和擁有GET Bucket Website權限的子用戶才能執行此操作,否則會返回403 AccessDenied錯誤。
請求語法
GET /?website HTTP/1.1
Host: BucketName.oos-cn.ctyunapi.cn
Date: date
Authorization: SignatureValue
請求參數
| 名稱 | 描述 | 是否必須 |
|---|---|---|
| BucketName | 存儲桶名稱。 | 是 |
響應結果
| 名稱 | 描述 |
|---|---|
| WebsiteConfiguration | 響應的容器。 類型:容器。 子節點:IndexDocument、ErrorDocument、RoutingRules 或 RedirectAllRequestsTo。 |
| IndexDocument | Suffix元素的容器。 類型:容器。 父節點:WebsiteConfiguration。 子節點:Suffix。 |
| Suffix | 在請求website endpoint時,Suffix會被加在請求的后面。 類型:字符串。 父節點:IndexDocument。 |
| ErrorDocument | Key的容器。 類型:容器。 父節點:WebsiteConfiguration。 子節點:Key。 |
| Key | 如果出現 4XX 錯誤,返回的Object。 類型:字符串。 父節點:ErrorDocument。 |
| RoutingRules | 托管模式配置到當前Bucket的重定向規則容器。 類型:容器。 父節點:WebsiteConfiguration。 子節點:RoutingRule。 |
| RoutingRule | 具體重定向規則的容器。 父節點:RoutingRules。 子節點:Condition、Redirect。 |
| Condition | 描述重定向規則匹配的條件的容器。 類型:容器。 父節點:RoutingRule。 子節點:HttpErrorCodeReturnedEquals、KeyPrefixEquals。 |
| HttpErrorCodeReturnedEquals | Redirect生效時的HTTP錯誤碼。 類型:字符串。 父節點:Condition。 |
| KeyPrefixEquals | 重定向規則生效時的文件名的前綴。 類型:字符串。 父節點:Condition。 |
| Redirect | 重定信息容器。 類型:容器。 父節點:RoutingRule。 子節點:Protocol、HostName、ReplaceKeyPrefixWith、ReplaceKeyWith。 |
| Protocol | 描述重定向請求時使用的協議。 類型:字符串。 父節點:Redirect或者RedirectAllRequestsTo。 |
| HostName | 重定向請求時使用的站點名。 類型:字符串。 父節點:Redirect或者RedirectAllRequestsTo。 |
| ReplaceKeyPrefixWith | 重定向請求時使用的文件名前綴。 類型:字符串。 父節點:Redirect。 |
| ReplaceKeyWith | 重定向請求時使用的文件名。 類型:字符串。 父節點:Redirect。 |
| RedirectAllRequestsTo | 托管模式為重定向請求的容器。 父節點:WebsiteConfiguration。 子節點:HostName、Protocol。 |
請求示例
GET?/?website?HTTP/1.1
x-amz-content-sha256:?e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date:?20220718T091530Z
Host:?example-bucket.oos-cn.ctyunapi.cn
Accept:?text/html,?image/gif,?image/jpeg,?*;?q=.2,?*/*;?q=.2
Connection:?keep-alive
Authorization: SignatureValue
響應示例
HTTP/1.1 200 OK
Content-Type: application/xml;charset=UTF-8
Date: Mon, 18 Jul 2022 09:15:30 GMT
x-amz-request-id: 88d52b33bef4440b3a867d8e9491947396a0828487828b9778
Content-Length: 430
Server: CTYUN
<?xml version="1.0" encoding="UTF-8"?>
<WebsiteConfiguration xmlns="//s3.amazonaws.com/doc/2006-03-01/">
<IndexDocument>
<Suffix>index.html</Suffix>
</IndexDocument>
<ErrorDocument>
<Key>error.html</Key>
</ErrorDocument>
<RoutingRules>
<RoutingRule>
<Condition>
<KeyPrefixEquals>images/</KeyPrefixEquals>
</Condition>
<Redirect>
<ReplaceKeyWith>errorpage.html</ReplaceKeyWith>
</Redirect>
</RoutingRule>
</RoutingRules>
</WebsiteConfiguration>