Problem description
The presigned URL request is missing the X-Amz-Date parameter.
Causes
The request uses an Amazon S3-compatible Signature Version 4 (SigV4), but X-Amz-Date is absent from the URL query string. This parameter specifies the time when the request is initiated. Without it, OSS cannot validate the signature or determine whether the URL has expired.
Examples
The following request is missing X-Amz-Date:
GET /test.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=LTAI****************/20221220/us-east-1/s3/aws4_request&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: trueSolutions
Add X-Amz-Date to the URL query string. Its value must follow the ISO 8601 basic format: yyyyMMddTHHmmssZ.
The corrected request:
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: trueTo avoid constructing presigned URLs manually, use an Amazon S3 SDK, which generates all required parameters automatically. For setup instructions, see Use Amazon S3 SDKs to access OSS.
该文章对您有帮助吗?