跳到主要内容

彩票注册即送 GetBucketWebsite

彩票注册即送 GetBucketWebsite操作用于查看bucket的静态网站托管状态。

请求语法

GET /?website HTTP/1.1
Host: bucketname.cos.cpzckhwz.sbs
Date: GMT Date
Authorization: SignatureValue

响应元素

NameTypeDescription
ErrorDocumentObject子元素Key的父元素
IndexDocumentObject子元素Suffix的父元素
KeyString返回404错误时使用的文件名
SuffixString返回主页URL时添加的索引文件名

细节分析

  1. 如果Bucket不存在,返回404错误。错误码:NoSuchBucket
  2. 只有Bucket的拥有者才能查看Bucket的静态网站托管状态,否则返回403 Forbidden错误,错误码:AccessDenied
  3. 如果源Bucket未设置静态网站托管功能,COS会返回404错误,错误码为:NoSuchWebsiteConfiguration

示例

请求示例

Get /?website HTTP/1.1
Host: test-bucket.cos.cpzckhwz.sbs
Date: Thu, 13 Sep 2012 07:51:28 GMT
Authorization: COS qn6qrrqxo2oawuk53otfjbyc: BuG4rRK+zNhH1AcF51NNHD39zXw=

返回示例

已设置Website返回示例

HTTP/1.1 200
x-cos-request-id: 534B371674E88A4D8906008B
Date: Thu, 13 Sep 2012 07:51:28 GMT
Connection: keep-alive
Content-Length: 218
Server: COS

{
"IndexDocument":{
"Suffix": "index.html"
},
"ErrorDocument":{
"Key": "errorDocument.html"
}
}

未设置website返回示例

HTTP/1.1 404 
x-cos-request-id: 534B371674E88A4D8906008B
Date: Thu, 13 Sep 2012 07:56:46 GMT
Connection: keep-alive
Content-Length: 308
Server: COS

{
"Code": "NoSuchWebsiteConfiguration",
"Message": "IndexWebsiteNotConfigured",
"Resource": "/test-bucket",
"RequestId": "f83d592bac100000015316fcdeec091b"
}