Get Bucket Website

Last Updated: Mar 20, 2017

The Get Bucket Website operation is used to view the static website hosting status of a bucket.

Request syntax

  1. GET /?website HTTP/1.1
  2. Host: BucketName.oss-cn-hangzhou.aliyuncs.com
  3. Date: GMT Date
  4. Authorization: SignatureValue

Response elements

Name Description
ErrorDocument The parent element of the child element key
Type: container
Parent element: WebsiteConfiguration
IndexDocument The parent element of the child element suffix
Type: container
Parent element: WebsiteConfiguration
Key The file name used to return Error 404
Type: string Parent element: WebsiteConfiguration.ErrorDocument
This element is required when ErrorDocument is set
Suffix The index file name added when a directory URL is returned. This element cannot be empty or contain a slash (/). For example, if the index file index.html is configured, oss-cn-hangzhou.aliyuncs.com/mybucket/mydir/ contained in an access request is converted into oss-cn-hangzhou.aliyuncs.com/mybucket/index.html by default.
Type: string
Parent element: WebsiteConfiguration.IndexDocument
WebsiteConfiguration Requested container
Type: container
Parent element: none

Detail analysis

  1. If a bucket does not exist, the error “404 no content” will be returned. Error code: NoSuchBucket.
  2. Only the owner of a bucket can view the static website hosting status of the bucket. If other users attempt to access the status information, the error 403 Forbidden with the error code: AccessDenied will be returned.
  3. If the source bucket is not configured with static website hosting, OSS returns Error 404 with the error code: NoSuchWebsiteConfiguration.

Example

Request example:

  1. Get /?website HTTP/1.1
  2. Host: oss-example.oss-cn-hangzhou.aliyuncs.com
  3. Date: Thu, 13 Sep 2012 07:51:28 GMT
  4. Authorization: OSS qn6qrrqxo2oawuk53otfjbyc: BuG4rRK+zNhH1AcF51NNHD39zXw=

Response example with logging rules configured:

  1. HTTP/1.1 200
  2. x-oss-request-id: 534B371674E88A4D8906008B
  3. Date: Thu, 13 Sep 2012 07:51:28 GMT
  4. Connection: keep-alive
  5. Content-Length: 218
  6. Server: AliyunOSS
  7. <?xml version="1.0" encoding="UTF-8"?>
  8. <WebsiteConfiguration xmlns=”http://doc.oss-cn-hangzhou.aliyuncs.com”>
  9. <IndexDocument>
  10. <Suffix>index.html</Suffix>
  11. </IndexDocument>
  12. <ErrorDocument>
  13. <Key>error.html</Key>
  14. </ErrorDocument>
  15. </WebsiteConfiguration>

Return example with LOG rules not set

  1. HTTP/1.1 404
  2. x-oss-request-id: 534B371674E88A4D8906008B
  3. Date: Thu, 13 Sep 2012 07:56:46 GMT
  4. Connection: keep-alive
  5. Content-Length: 308
  6. Server: AliyunOSS
  7. <?xml version="1.0" encoding="UTF-8"?>
  8. <Error xmlns=”http://doc.oss-cn-hangzhou.aliyuncs.com”>
  9. <Code>NoSuchWebsiteConfiguration</Code>
  10. <Message>The specified bucket does not have a website configuration.</Message>
  11. <BucketName>oss-example</BucketName>
  12. <RequestId>505191BEC4689A033D00236F</RequestId>
  13. <HostId>oss-example.oss-cn-hangzhou.aliyuncs.com</HostId>
  14. </Error>
Thank you! We've received your feedback.