Problem description
A PutBucketLifecycle request fails when the request body contains multiple rules with overlapping prefixes that specify conflicting lifecycle actions.
Causes
OSS enforces two ordering constraints on lifecycle rules. When overlapping-prefix rules collectively violate either constraint, OSS rejects the request.
Constraint 1: Infrequent Access (IA) before Archive
If one rule transitions objects to IA and another transitions the same objects to Archive, the Archive transition must be scheduled for a later day than the IA transition. This ordering reflects the storage tier hierarchy: objects must pass through IA before reaching Archive.
Constraint 2: Expiration after all transitions
Object expiration must be scheduled for a later day than any storage class transition (IA or Archive) that applies to the same objects. Expiring an object before it transitions creates an unresolvable conflict in the lifecycle engine.
Rules have overlapping prefixes when one prefix is a path prefix of another (for example, test and test/log). OSS evaluates all matching rules against an object, so the combined effect of overlapping rules must satisfy both constraints.
Examples
The following request configures three rules with overlapping prefixes (test, test/log, test/log/cache). Because these prefixes overlap, OSS evaluates all three rules against objects under test/log/cache. The combined effect violates both constraints: the Archive transition (60 days) is earlier than the IA transition (120 days), and the expiration (30 days) is earlier than both transitions.
PUT /?lifecycle HTTP/1.1
Host: oss-example.oss.aliyuncs.com
Content-Length: 336
Date: Mon , 6 May 2019 15:23:20 GMT
Authorization: OSSqn6q**************:77Dv****************
<?xml version="1.0" encoding="UTF-8"?>
<LifecycleConfiguration>
<Rule>
<ID>rule1</ID>
<Prefix>test</Prefix>
<Status>Enabled</Status>
<Transition>
<Days>120</Days>
<StorageClass>IA</StorageClass>
</Transition>
</Rule>
<Rule>
<ID>rule2</ID>
<Prefix>test/log</Prefix>
<Status>Enabled</Status>
<Transition>
<Days>60</Days>
<StorageClass>Archive</StorageClass>
</Transition>
</Rule>
<Rule>
<ID>rule3</ID>
<Prefix>test/log/cache</Prefix>
<Status>Enabled</Status>
<Expiration>
<Days>30</Days>
</Expiration>
</Rule>
</LifecycleConfiguration>Solutions
Option 1: Fix the day values
Set transition and expiration days in ascending order across all overlapping rules. In the corrected example below, objects under test/log/cache are governed by all three rules—they transition to IA at 30 days, to Archive at 60 days, and expire at 120 days, satisfying both constraints.
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>rule1</ID>
<Prefix>test</Prefix>
<Status>Enabled</Status>
<Transition>
<Days>30</Days>
<StorageClass>IA</StorageClass>
</Transition>
</Rule>
<Rule>
<ID>rule2</ID>
<Prefix>test/log</Prefix>
<Status>Enabled</Status>
<Transition>
<Days>60</Days>
<StorageClass>Archive</StorageClass>
</Transition>
</Rule>
<Rule>
<ID>rule3</ID>
<Prefix>test/log/cache</Prefix>
<Status>Enabled</Status>
<Expiration>
<Days>120</Days>
</Expiration>
</Rule>
</LifecycleConfiguration>Option 2: Use the OSS console
Configure lifecycle rules in the OSS console to avoid manually constructing request bodies.