Object Storage API, Amazon S3-compatible REST: PutBucketWebsite
Uploads a static website hosting configuration for a bucket.
For more information on getting started with the API and the general request format, see How to use the S3 API.
Request
PUT /{bucket}?website HTTP/2
Path parameters
|
Parameter |
Description |
|
|
Bucket name |
Query parameters
|
Parameter |
Description |
|
|
Required parameter that indicates the type of operation |
Headings
Use the appropriate common headers in your request.
Data schema
You can configure a bucket:
Configuration example:
<!--Website configuration-->
<WebsiteConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<IndexDocument>
<Suffix>index.html</Suffix>
</IndexDocument>
<ErrorDocument>
<Key>Error.html</Key>
</ErrorDocument>
</WebsiteConfiguration>
Possible elements:
|
Element |
Description |
|
|
Top-level header of the website description. |
|
|
Website home page. Path: |
|
|
Document the user sees in case of Path: |
Configuration example:
<!--Configuration for redirecting all requests-->
<WebsiteConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<RedirectAllRequestsTo>
<HostName>example.com</HostName>
<Protocol>http</Protocol>
</RedirectAllRequestsTo>
</WebsiteConfiguration>
Possible elements:
|
Element |
Description |
|
|
Top-level header of the website description. |
|
|
Contains the configuration for redirecting all requests. Path: |
|
|
Host to which all requests to the bucket are redirected. Path: |
|
|
Protocol used for redirects: Path: |
Configuration example:
<!--Configuration for conditional redirects-->
<WebsiteConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<IndexDocument>
<Suffix>index.html</Suffix>
</IndexDocument>
<ErrorDocument>
<Key>Error.html</Key>
</ErrorDocument>
<RoutingRules>
<RoutingRule>
<Condition>
<KeyPrefixEquals>k8s/</KeyPrefixEquals>
</Condition>
<Redirect>
<ReplaceKeyPrefixWith>kubernetes/</ReplaceKeyPrefixWith>
</Redirect>
</RoutingRule>
</RoutingRules>
</WebsiteConfiguration>
Possible elements:
|
Element |
Description |
|
|
Top-level header of the website description. |
|
|
Website home page. |
|
|
Document the user sees in case of |
|
|
|
|
|
Routing rule. |
|
|
Container of conditions to trigger the redirect. If a routing rule does not contain any conditions, all requests are redirected. |
|
|
The condition specifies the prefix of the object key the requests are redirected from. |
|
|
This condition specifies the error code that triggers a redirect. |
|
|
Redirect container. |
|
|
In the |
|
|
In the |
|
|
The redirect specifies the object key prefix to replace the |
|
|
The redirect specifies the object key to use in the |
|
|
In the |
Response
Headers
Responses can only contain common headers.
Response codes
For a list of possible responses, see Responses.