0006-00000003

更新时间:
复制 MD 格式

Problem description

A PostObject request fails because the uploaded object exceeds the allowed size.

Causes

  • Hard limit exceeded: The object is larger than 5 GB. PostObject does not support objects larger than 5 GB.

  • Policy condition violated: The policy field contains a content-length-range condition, and the object size falls outside the specified range.

Examples

The following request fails because big.img has a Content-Length of 6443500495, which exceeds the 5 GB limit. The Base64-decoded policy also sets content-length-range to a maximum of 1048576000 bytes (approximately 1 GB).

POST / HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Content-Length: 6443500495
Date: Sat, 18 Feb 2023 05:17:02 GMT
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryW0DET1iaBMeAOBg3
Host: example-bucket.oss-cn-hangzhou.aliyuncs.com
------WebKitFormBoundaryW0DET1iaBMeAOBg3
Content-Disposition: form-data; name="name"
big.img
------WebKitFormBoundaryW0DET1iaBMeAOBg3
Content-Disposition: form-data; name="key"
${filename}
------WebKitFormBoundaryW0DET1iaBMeAOBg3
Content-Disposition: form-data; name="policy"
eyJleHBpcmF0aW9uIjoiMjAyMy0wMi0xOFQxMzoxOTowMC4wMDBaIiwiY29uZGl0aW9ucyI6W1siY29udGVudC1sZW5ndGgtcmFuZ2UiLDAsMTA0ODU3NjAwMF1dfQ==
------WebKitFormBoundaryW0DET1iaBMeAOBg3
Content-Disposition: form-data; name="OSSAccessKeyId"
LTAI****************
------WebKitFormBoundaryW0DET1iaBMeAOBg3
Content-Disposition: form-data; name="success_action_status"
200
------WebKitFormBoundaryW0DET1iaBMeAOBg3
Content-Disposition: form-data; name="signature"
miAo****************
------WebKitFormBoundaryW0DET1iaBMeAOBg3
Content-Disposition: form-data; name="file"; filename="big.img"
Content-Type: application/octet-stream
***
------WebKitFormBoundaryW0DET1iaBMeAOBg3--

Solutions

  • Hard limit exceeded: Make sure the object is no larger than 5 GB before uploading via PostObject.

  • Policy condition violated: If the policy field contains a content-length-range condition, make sure the object size falls within the specified range. The content-length-range condition uses the following format, where values are in bytes:

    ["content-length-range", <min-bytes>, <max-bytes>]

    For example, to allow objects between 1 MiB and 10 MiB:

    ["content-length-range", 1048576, 10485760]

    The policy field is a UTF-8 and Base64-encoded JSON string. To check the effective range, decode the policy form field value and inspect the conditions array.

References