Problem description
The expiration time in the URL signature is invalid.
Causes
You use the URL signature method to initiate a request. However, the values of the Expires or x-oss-expires field in the URL is invalid.
Examples
Use the V1 signature to initiate a request
If you use the V1 signature to initiate a request, the
Expiresfield is used to specify the expiration time of the URL. The following sample code provides an example of invalid value of the Expires field: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.comUse the V2 signature to initiate a request
If you use the V2 signature to initiate a request, the
x-oss-expiresfield is used to specify the expiration time of the URL. The following sample code provides an example of invalid value of the x-oss-expires field: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.com
The expiration time of the URL is a UNIX timestamp, which is the number of seconds that have elapsed since January 1, 1970 00:00:00 UTC. If the time when Object Storage Service (OSS) receives the request that contains the URL is later than the value of the Expires or x-oss-expires parameter that is included in the signature, a request timeout error is returned.
Solutions
Make sure that the Expires or x-oss-expires field is included in the URL and a correct value is specified for the field. For example, if the current time is 1141889060 and you want to create a URL that is valid within 60 seconds, you must set the Expires parameter to 1141889120. The following code provides an example of a request that uses the V1 signature:
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.comFor more information, see Add signatures to URLs.
We recommend that you use Alibaba Cloud SDKs to initiate requests. Alibaba Cloud SDKs automatically generate signatures for the requests without the need to manually calculate a signature. For more information, see Overview.