Problem description
X-Amz-Expires is missing from the presigned URL query string. OSS rejects the request because the expiration time is not specified.
Causes
When using Amazon S3-compatible Signature Version 4 to generate presigned URLs, X-Amz-Expires is a required query string parameter. If it is absent, OSS cannot determine when the URL expires and rejects the request.
Examples
The following request is missing X-Amz-Expires. The X-Amz-Date value is also malformed — 86400 is appended directly to the timestamp instead of appearing as a separate X-Amz-Expires parameter:
GET /test.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=LTAI****************/20221220/us-east-1/s3/aws4_request&X-Amz-Date=20221220T084818Z86400&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: trueThe required signature parameters for a valid presigned request are:
| Parameter | Description |
|---|---|
X-Amz-Algorithm | Signing algorithm. For Signature Version 4, use AWS4-HMAC-SHA256. |
X-Amz-Credential | Credential scope, in the format <AccessKeyID>/<date>/<region>/s3/aws4_request. |
X-Amz-Date | Signing timestamp in ISO 8601 format: YYYYMMDDTHHMMSSZ. |
X-Amz-Expires | A UNIX timestamp that specifies the expiration time of the request. |
X-Amz-SignedHeaders | HTTP headers included in the signature calculation. |
X-Amz-Signature | The computed request signature. |
Solutions
Add X-Amz-Expires as a separate query string parameter and correct the X-Amz-Date value so it contains only the ISO 8601 timestamp:
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 manually constructing presigned URLs, use Amazon S3 SDKs, which handle all required parameters automatically. For setup instructions, see Use Amazon S3 SDKs to access OSS.