0002-00000713

更新时间:
复制 MD 格式

Problem description

The X-Amz-Date form field is missing from the PostObject request.

Causes

When you initiate a PostObject request that uses the Amazon S3-compatible V4 signature, X-Amz-Date identifies the signing time and is a required form field. Without it, OSS cannot validate the signature.

Examples

The following PostObject request uses Amazon S3-compatible V4 signature but omits the X-Amz-Date field:

Content-Type: multipart/form-data; boundary=<boundary>

--<boundary>
Content-Disposition: form-data; name="key"
<object-key>
--<boundary>
Content-Disposition: form-data; name="X-Amz-Algorithm"
AWS4-HMAC-SHA256
--<boundary>
Content-Disposition: form-data; name="X-Amz-Credential"
<access-key-id>/20240315/oss-cn-hangzhou/s3/aws4_request
--<boundary>
Content-Disposition: form-data; name="X-Amz-Signature"
<calculated-signature>
--<boundary>
Content-Disposition: form-data; name="policy"
<base64-encoded-policy>
--<boundary>
Content-Disposition: form-data; name="file"
<file-content>
--<boundary>--

The X-Amz-Date field is absent, which causes the error.

Solutions

Add X-Amz-Date to the PostObject form body and set it to the signing time in yyyyMMddTHHmmssZ format — for example, 20240315T092300Z. Also make sure that a valid value is specified for the X-Amz-Algorithm form field.

A correctly structured PostObject form body looks like:

Content-Type: multipart/form-data; boundary=<boundary>

--<boundary>
Content-Disposition: form-data; name="key"
<object-key>
--<boundary>
Content-Disposition: form-data; name="X-Amz-Algorithm"
AWS4-HMAC-SHA256
--<boundary>
Content-Disposition: form-data; name="X-Amz-Credential"
<access-key-id>/20240315/oss-cn-hangzhou/s3/aws4_request
--<boundary>
Content-Disposition: form-data; name="X-Amz-Date"
20240315T092300Z
--<boundary>
Content-Disposition: form-data; name="X-Amz-Signature"
<calculated-signature>
--<boundary>
Content-Disposition: form-data; name="policy"
<base64-encoded-policy>
--<boundary>
Content-Disposition: form-data; name="file"
<file-content>
--<boundary>--

For details on constructing the request and calculating the signature, see PostObject.