Problem description
In the XML request body of the PutBucketLifecycle request, duplicate values are specified for the Key child node in the Tag node.
Causes
You initiated a PutBucketLifecycle request, but duplicate values are specified for the Key child node in the Tag node in the XML request body. In this case, a request error occurs.
Examples
In the following sample code, the Tag node in the XML request body contains two Key child nodes whose value is test.
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: OSS qn6q**************:77Dv****************
<?xml version="1.0" encoding="UTF-8"?>
<LifecycleConfiguration>
<Rule>
<ID>abc</ID>
<Status>Enabled</Status>
<Prefix>log/</Prefix>
<Tag>
<Key>test</Key>
<Value>abc</Value>
</Tag>
<Tag>
<Key>test</Key>
<Value>xyz</Value>
</Tag>
<Expiration>
<Days>30</Days>
</Expiration>
</Rule>
</LifecycleConfiguration>Solutions
Make sure that each Tag node in the XML request body contains the Key and Value child nodes and each Key child node is unique.
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: OSS qn6q**************:77Dv****************
<?xml version="1.0" encoding="UTF-8"?>
<LifecycleConfiguration>
<Rule>
<ID>abc</ID>
<Status>Enabled</Status>
<Prefix>log/</Prefix>
<Tag>
<Key>test</Key>
<Value>abc</Value>
</Tag>
<Tag>
<Key>otherkey</Key>
<Value>xyz</Value>
</Tag>
<Expiration>
<Days>30</Days>
</Expiration>
</Rule>
</LifecycleConfiguration>Configure lifecycle rules in the Object Storage Service (OSS) console to automatically create request bodies.