Problem description
The policy form field in a PostObject request has expired.
Causes
PostObject requests include an expiration field in the policy form field. This field specifies the deadline, in ISO 8601 UTC format, by which the server must receive the complete request. If the server receives the request after that deadline, OSS rejects it.
This error can be triggered by any of the following conditions:
Policy generated too early: The policy was created long before the upload started. By the time the request reaches the server, the policy has already expired.
Client clock drift: The client system clock is out of sync with the server clock. Even if the client considers the request to be within the valid window, the server's clock may disagree.
Slow upload: Uploading a large object takes time. The policy may still be valid when the upload begins, but it may expire before the server receives the complete request.
Examples
The following policy sets expiration to 2023-02-19T13:19:00.000Z — that is, 1:19 PM UTC on February 19, 2023. OSS rejects any PostObject request that arrives after that moment.
{
"expiration": "2023-02-19T13:19:00.000Z",
"conditions": [
["content-length-range", 0, 1048576000]
]
}| Field | Description |
|---|---|
expiration | The deadline by which the server must receive the request, in ISO 8601 UTC format |
content-length-range | Restricts the accepted object size — in this example, 0 to 1,048,576,000 bytes |
Solutions
Set the
expirationvalue far enough in the future so the server can receive the complete PostObject request before it expires. Account for upload time when calculating the expiration window, especially for large objects.Sync the client system clock with an NTP server to eliminate clock drift as a source of error.
References
For details on the
policyform field, see the "Appendix: Policy" section of PostObject.To learn how to upload from a web client using form upload, see Add signatures on the client by using JavaScript and upload data to OSS.
For common PostObject errors and how to fix them, see PostObject error handling.