0014-00000041
Updated at:
Problem description
A PutBucketLifecycle request fails when the ObjectSizeGreaterThan value is greater than the ObjectSizeLessThan value in the Filter element.
Causes
The Filter element supports two size-based parameters that define a size range:
| Parameter | Description |
|---|---|
ObjectSizeGreaterThan | Specifies the minimum size of the files to retain during filtering. |
ObjectSizeLessThan | Specifies the maximum size of the files to retain during filtering. |
OSS rejects the request if ObjectSizeGreaterThan is greater than ObjectSizeLessThan.
Examples
In the following request, ObjectSizeLessThan is 100 and ObjectSizeGreaterThan is 200. Because 200 > 100, OSS rejects this configuration and returns an error.
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>rule</ID>
<Prefix>test</Prefix>
<Status>Enabled</Status>
<Filter>
<ObjectSizeLessThan>100</ObjectSizeLessThan>
<ObjectSizeGreaterThan>200</ObjectSizeGreaterThan>
</Filter>
<Expiration>
<Days>100</Days>
<ExpiredObjectDeleteMarker>true</ExpiredObjectDeleteMarker>
</Expiration>
</Rule>
</LifecycleConfiguration>Solutions
Set ObjectSizeGreaterThan to a value strictly less than ObjectSizeLessThan. The following example applies a lifecycle rule to objects between 100 bytes and 500 bytes:
<Filter>
<ObjectSizeGreaterThan>100</ObjectSizeGreaterThan>
<ObjectSizeLessThan>500</ObjectSizeLessThan>
</Filter>Alternatively, configure lifecycle rules in the Object Storage Service (OSS) console to automatically create request bodies.
References
Is this page helpful?