0002-00000415

更新时间:
复制 MD 格式

Problem description

The X-Amz-Date query parameter in the request uses an invalid format.

Causes

OSS received a request using the Amazon S3-compatible Signature Version 4 (SigV4) authentication, but the X-Amz-Date value is not in the required format.

X-Amz-Date must be in the following format: yyyyMMddTHHmmssZ.

For example, convert 2022-12-20-08:48:18 (invalid) to 20221220T084818Z (valid).

Examples

The following request fails because X-Amz-Date uses an invalid format:

GET /test.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=LTAI****************/20221220/us-east-1/s3/aws4_request&X-Amz-Date=2022-12-20-08:48:18&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=ab2***st HTTP/1.0
Date: Tue, 20 Dec 2022 08:48:18 GMT
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
x-oss-s3-compat: true

The X-Amz-Date value 2022-12-20-08:48:18 is invalid. The correct value for this timestamp is 20221220T084818Z.

Solutions

Replace the invalid X-Amz-Date value with a correctly formatted one, and make sure all other query parameters are present and valid:

GET /test.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=LTAI****************/20221220/us-east-1/s3/aws4_request&X-Amz-Date=20221220T084818Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=ab2s**** HTTP/1.0
Date: Tue, 20 Dec 2022 08:48:18 GMT
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
x-oss-s3-compat: true

To avoid manually constructing SigV4 requests, use an Amazon S3 SDK. For more information, see Use Amazon S3 SDKs to access OSS.