Set static website hosting
Updated at:2025-11-03
API description
This API is used to configure static website hosting.
Users must have FULL_CONTROL permission for the bucket. It is not recommended to use archive files for this purpose. Unretrieved archive files are unreadable, and StaticWebsite functionality will not work in such cases.
Request URI
PUT /v1/{bucketName}/?website
| Parameter name | Parameter type | Required or not | Description | Example value | Parameter location |
|---|---|---|---|---|---|
| bucketName | String | Yes | Bucket name | "bucketName_example" | Path |
Parameters of request body
Description of the data structure of request body fields
| Parameter name | Parameter type | Required or not | Description | Example value |
|---|---|---|---|---|
| index | String | No | Index file name | index.html |
| notFound | String | No | 404 file name | 404.html |
| notFoundHttpStatus | String | No | HTTP status codes returned on error pages include: 200, 404 (default). | 404 |
At least one of index and notFound must be set
Response body parameters
Description of the data structure of response body fields
Request example
JSON
1PUT /v1/bucketName_example/?website
2 <Common request headers>
3 PUT /?website HTTP/1.1
4 Host: <BcuketName>.bj.bcebos.com
5 Date: Tue, 17 May 2016 08:36:52 GMT
6 Authorization: AuthorizationString
7 Content-Length: 65
8 {
9 "index": "index.html",
10 "notFound": "404.html"
11 }
Response example
JSON
1HTTP/1.1 200 OK
2 <Common response headers>
3 HTTP/1.1 200 OK
4 x-bce-request-id: 1a5fd81e-626b-45b3-a885-15fff9cd106c
5 Date: Tue, 17 May 2016 08:36:52 GMT
6 Content-Length: 0
7 Server: BceBos
Error code
Please refer to the general error codes
