PutBucketWebsite
Sets the website configuration for a bucket. When you enable static website hosting, you can access the website using the bucket's website endpoint.
Permissions
To use this operation, you must have the PutBucketWebsite
permission on the bucket. By default, only the bucket owner has this permission.
Request Headers
Name | Description | Required | Type |
---|---|---|---|
Content-MD5 | The base64-encoded 128-bit MD5 digest of the website configuration. | Yes | String |
x-amz-expected-bucket-owner | The account ID of the expected bucket owner. | No | String |
Request URI Parameters
Name | Description | Required | Type |
---|---|---|---|
Bucket | The bucket name. | Yes | String |
Request Body
The request must include an XML document with a WebsiteConfiguration
element. The configuration includes the following elements:
Name | Description | Required | Type |
---|---|---|---|
ErrorDocument | The object key name to use when a 4XX class error occurs. | No | Container |
IndexDocument | Container for the suffix that is appended to a request that is for a directory on the website endpoint. | Yes | Container |
RedirectAllRequestsTo | Container for redirect information. You can redirect all requests to another website. | No | Container |
RoutingRules | Container for a collection of RoutingRule elements. | No | Container |
Request Syntax
PUT /?website HTTP/1.1
Host: example-bucket.qstorage.quilibrium.com
Content-MD5: ContentMD5
x-amz-expected-bucket-owner: ExpectedBucketOwner
<?xml version="1.0" encoding="UTF-8"?>
<WebsiteConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<ErrorDocument>
<Key>error.html</Key>
</ErrorDocument>
<IndexDocument>
<Suffix>index.html</Suffix>
</IndexDocument>
<RedirectAllRequestsTo>
<HostName>example.com</HostName>
<Protocol>https</Protocol>
</RedirectAllRequestsTo>
<RoutingRules>
<RoutingRule>
<Condition>
<KeyPrefixEquals>docs/</KeyPrefixEquals>
</Condition>
<Redirect>
<ReplaceKeyWith>documents/</ReplaceKeyWith>
</Redirect>
</RoutingRule>
</RoutingRules>
</WebsiteConfiguration>
Response Headers
The operation returns only common response headers.
Response Body
This operation does not return a response body.
Response Errors
Name | Description | Required | Type |
---|---|---|---|
InvalidArgument | Invalid argument. | No | Error |
MalformedXML | The XML provided was not well-formed or did not validate against the published schema. | No | Error |
Examples
Configure a Bucket as a Static Website
The following request configures a bucket for website hosting. The configuration specifies index.html as the index document and error.html as the error document.
Sample Request
PUT /?website HTTP/1.1
Host: example-bucket.qstorage.quilibrium.com
Content-MD5: 0123456789abcdef0123456789abcdef
Date: Thu, 27 Jan 2024 12:00:00 GMT
Authorization: authorization string
<?xml version="1.0" encoding="UTF-8"?>
<WebsiteConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<IndexDocument>
<Suffix>index.html</Suffix>
</IndexDocument>
<ErrorDocument>
<Key>error.html</Key>
</ErrorDocument>
</WebsiteConfiguration>
Sample Response
HTTP/1.1 200 OK
x-amz-request-id: 1234567890ABCDEF
Date: Thu, 27 Jan 2024 12:00:00 GMT
Server: QStorage
API Test Component
Test
Coming Soon
This feature is currently under development and will be available soon.