0002-00000067

更新时间:
复制 MD 格式

Problem description

The Expires field is missing from a signed URL.

Causes

The signed URL does not include the Expires query parameter, which Object Storage Service (OSS) requires to validate whether the URL is still valid at the time of the request.

Examples

The following request is missing the Expires field:

GET /test.txt?OSSAccessKeyId=nz2p****&Signature=vjbyPxybdZaNmGa%2ByT272YEAiv**** HTTP/1.0
Date: Tue, 20 Dec 2022 08:48:18 GMT
Host: oss-example.oss-cn-hangzhou.aliyuncs.com

The Expires field specifies the URL's expiration time as a Unix timestamp — the number of seconds elapsed since 1970-01-01 00:00:00. If OSS receives the request after the timestamp value included in the signature, it returns a request timeout error.

For example, if the current time is 1141889060 and you want the URL to be valid for 60 seconds, set Expires to 1141889120.

Solutions

Add the Expires field to the signed URL query string and set it to a valid Unix timestamp.

The corrected request looks like this:

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.com
Query parameterDescriptionExample
OSSAccessKeyIdAlibaba Cloud AccessKey IDnz2p****
ExpiresUnix timestamp indicating when the URL expires1141889120
SignatureURL signature computed over the request parametersvjbyPxybdZaNmGa%2ByT272YEAiv****

For details on constructing signed URLs, see Add signatures to URLs.

Use the Alibaba Cloud SDKs to generate signed URLs — the SDKs compute signatures automatically and include all required parameters. For more information, see Overview.