Problem description
The expiration time in the URL signature is invalid.
Causes
The Expires (V1 signature) or x-oss-expires (V2 signature) parameter in the signed URL is set to a non-integer value. OSS requires this value to be a valid UNIX timestamp — an integer representing the number of seconds elapsed since January 1, 1970 00:00:00 UTC.
| Signature version | Expiration parameter |
|---|---|
| V1 | Expires |
| V2 | x-oss-expires |
OSS evaluates the expiration at the moment the request arrives. If the request reaches OSS after the timestamp value, OSS returns a request timeout error.
Examples
The following examples show requests with invalid expiration values.
V1 signature — invalid `Expires` value:
GET /test.txt?OSSAccessKeyId=nz2p****&Expires=abc&Signature=vjbyPxybdZaNmGa%2ByT272YEAiv**** HTTP/1.0
Date: Tue, 20 Dec 2022 08:48:18 GMT
Host: oss-example.oss-cn-hangzhou.aliyuncs.comV2 signature — invalid `x-oss-expires` value:
GET /test.txt?x-oss-signature-version=OSS2&x-oss-expires=abc&x-oss-signature=abc***&x-oss-access-key-id=asfd*** HTTP/1.0
Date: Tue, 20 Dec 2022 08:48:18 GMT
Host: oss-example.oss-cn-hangzhou.aliyuncs.comSolutions
Set Expires (V1) or x-oss-expires (V2) to a valid integer UNIX timestamp that represents the time when the URL should stop being valid.
Example: If the current time is 1141889060 and you want the URL to be valid for 60 seconds, set Expires to 1141889120 (1141889060 + 60).
The following example shows a valid V1 request:
GET /test.txt?OSSAccessKeyId=nz2p****&Expires=1141889120&Signature=vjbyPxybdZaNmGa%2ByT272YEAiv**** HTTP/1.0
Date: Tue, 20 Dec 2022 08:48:18 GMT
Host: oss-example.oss-cn-hangzhou.aliyuncs.comTo avoid computing signatures manually, use an Alibaba Cloud SDK. SDKs generate signed URLs automatically without requiring you to calculate UNIX timestamps or signatures. For more information, see Overview.
For information about signed URLs, see Add signatures to URLs.