0014-00000001

Updated at:

Problem description

The XML request body of the PutBucketLifecycle request is empty.

Causes

You sent an Amazon S3-compatible PutBucketLifecycle request without a request body. OSS requires a valid XML body to configure a lifecycle rule. A Content-Length: 0 header indicates the body is missing.

Examples

The following request has an empty body (Content-Length: 0):

PUT /?lifecycle HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Content-Length: 0
Date: Mon , 6 May 2019 15:23:20 GMT
Authorization: AWS LTAI****************:Phuu****************

Solutions

Choose one of the following approaches.

Option 1: Include a valid XML request body (manual HTTP request)

Add a LifecycleConfiguration XML body to your request. The Content-Length header must reflect the actual byte length of the XML body.

The following example configures a lifecycle rule that transitions objects to a different storage class and expires them after a specified number of days:

PUT /?lifecycle HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Content-Length: 336
Date: Mon , 6 May 2019 15:23:20 GMT
Authorization: AWS LTAI****************:Phuu****************

<?xml version="1.0" encoding="UTF-8"?>
<LifecycleConfiguration>
  <Rule>
    <ID>RuleID</ID>
    <Prefix>Prefix</Prefix>
    <Status>Status</Status>
    <Expiration>
      <Days>Days</Days>
    </Expiration>
    <Transition>
      <Days>Days</Days>
      <StorageClass>StorageClass</StorageClass>
    </Transition>
    <AbortMultipartUpload>
      <Days>Days</Days>
    </AbortMultipartUpload>
  </Rule>
</LifecycleConfiguration>

Option 2: Use an Amazon S3-compatible SDK

Use an Amazon S3-compatible SDK to send the request. The SDK serializes the XML request body automatically, so you do not need to construct it manually.

Option 3: Use the OSS console

Configure lifecycle rules in the Object Storage Service (OSS) console. The console generates the request body automatically.

References