Problem description
The XML request body of the PutBucketLifecycle request contains multiple Prefix
child nodes in the Rule
node.
Causes
You initiated a PutBucketLifecycle request that is compatible with Amazon S3, but the XML request body contains multiple Prefix
child nodes in the Rule
node. You can specify only one Prefix
child node for each Rule
node.
Examples
In the following sample code, the PutBucketLifecycle request is compatible with Amazon S3, and the XML request body contains two Prefix
child nodes in the Rule
node.
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 Wnjl3fg9fdv8fg4b****:Phuu8bBhS8dsff2a****
<?xml version="1.0" encoding="UTF-8"?>
<LifecycleConfiguration>
<Rule>
<ID>rule</ID>
......
<Prefix>tmp/</Prefix>
<Prefix>private/</Prefix>
</Rule>
</LifecycleConfiguration>
Solutions
Make sure that the request contains only one
Prefix
child node in eachRule
node. If you want to specify multiplePrefix
child nodes, you must add theRule
node.The
Prefix
child node is used to specify the prefix of objects to which the rule is applied.If you specify Prefix, the rule applies only to objects whose names contain the specified prefix in a bucket.
If you do not specify Prefix, the rule is applied to all objects in the bucket.
Initiate a request by using an SDK that is compatible with Amazon S3.
Configure lifecycle rules in the Object Storage Service (OSS) console to automatically create request bodies.