Baidu AI Cloud
中国站

百度智能云

Object Storage

PutBucketStaticWebsite

Interface Description

This interface is used to set the static website hosting.

The user must have the FULL_CONTROL permission for the bucket. It is not recommended to set the archive file. The archive file is not unreadable when it is not retrieved, and StaticWebsite is not effective at this time.

Request

  • Request header field

    No special parameters.

  • Request parameters

    Name Description Type Required?
    index Index file name string No
    notFound 404 file name string No

Response

  • Response element

    None

  • Response header field

    None

Example

  • Request example

     PUT /?website HTTP/1.1
     Host: <BcuketName>.bj.bcebos.com
     Date: Tue, 17 May 2016 08:36:52 GMT
     Authorization: AuthorizationString
     Content-Length: 65
    
     {
         "index": "index.html",
         "notFound": "404.html"
     }
  • Response example

     HTTP/1.1 200 OK
     x-bce-request-id: 1a5fd81e-626b-45b3-a885-15fff9cd106c
     Date: Tue, 17 May 2016 08:36:52 GMT
     Content-Length: 0
     Server: BceBos
  • Return code

    Results Http Status Error Code Description
    Success 200 - -
    JSON format error 400 MalformedJSON -
    Incorrect JSON content 400 InappropriateJSON For example, both index and 404 file are empty.
    Index or 404 file name too long 400 EntityTooLarge Neither index nor 404 file name can exceed 1,024 bytes.
    The index or 404 file name is not allowed 400 InvalidStaticWebSiteFormat For example, the file format is not allowed, or the index is the same name as the 404 file.
    The static website hosting feature is disabled 501 StaticWebSiteIsDisable That is, BOS does not allow the bucket of this region to enable the static website hosting feature.
    For other errors, follow the previous error code of BOS - See Error Code -
Previous
GetBucketStaticWebsite
Next
Storage Bucket Inventory