PutBucketStaticWebsite
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
| Name | Description | Types | Required or not |
|---|---|---|---|
| index | Index file name | string | No |
| notFound | 404 file name | string | No |
| notFoundHttpStatus | HTTP status code shown when returning error pages. Options: "200", "404" (default). | string | No |
Response
Example
-
Request example
Plain Text1 PUT /?website HTTP/1.1 2 Host: <BcuketName>.bj.bcebos.com 3 Date: Tue, 17 May 2016 08:36:52 GMT 4 Authorization: AuthorizationString 5 Content-Length: 65 6 { 7 "index": "index.html", 8 "notFound": "404.html", 9 "notFoundHttpStatus": "200" 10 } -
Response example
Plain Text1 HTTP/1.1 200 OK 2 x-bce-request-id: 1a5fd81e-626b-45b3-a885-15fff9cd106c 3 Date: Tue, 17 May 2016 08:36:52 GMT 4 Content-Length: 0 5 Server: BceBos -
Return codes
| Result | http status | error code | Description |
|---|---|---|---|
| Succeeded | 200 | - | - |
| Json format error | 400 | MalformedJSON | - |
| Incorrect Json content | 400 | InappropriateJSON | For example, both index and 404 files are empty. |
| Index or 404 filename is too long. | 400 | EntityTooLarge | Neither the index nor the 404 filename can exceed 1024 bytes. |
| Index or 404 file names not allowed. | 400 | InvalidStaticWebSiteFormat | For instance, the file format may not be allowed, or the index and the 404 file might share the same name. |
| The static website hosting function is disabled. | 501 | StaticWebSiteIsDisable | In other words, it is not allowed to enable the static website hosting function for the bucket of this region. |
| Other errors, following previous error codes of BOS. | - | Refer to Error Codes | - |
