0002-00000215

更新时间:
复制 MD 格式

Problem description

The request is missing the x-oss-expires parameter, which is required for all V4 presigned URL requests.

Causes

The request uses V4 signature authentication (OSS4-HMAC-SHA256) but does not include x-oss-expires. This parameter specifies when the signature expires and is mandatory.

Examples

The following request triggers this error. The x-oss-expires parameter is absent from the query string:

GET /oss.jpg
  ?x-oss-signature-verion=OSS4-HMAC-SHA256
  &x-oss-credential=***
  &x-oss-additional-headers=host
  &x-oss-signature=8u**a3 HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Tue, 20 Dec 2022 08:48:18 GMT

Solutions

Add all required V4 signature parameters to the query string. The following table lists each parameter, whether it is required, and its expected value:

ParameterRequiredDescription
x-oss-signature-verionRequiredSignature algorithm identifier. Set to OSS4-HMAC-SHA256.
x-oss-credentialRequiredCredential string in the format <AccessKeyID>/<date>/<region>/oss/aliyun_v4_request.
x-oss-expiresRequiredSignature expiration time as a UNIX timestamp (seconds since epoch). OSS rejects requests received after this time.
x-oss-signatureRequiredThe computed signature value.
x-oss-additional-headersOptionalSemicolon-separated list of additional signed headers, such as host.

A correctly formed request looks like this:

GET /oss.jpg
  ?x-oss-signature-verion=OSS4-HMAC-SHA256
  &x-oss-credential=LTAI****************/20221220/cn-hangzhou/oss/aliyun_v4_request
  &x-oss-expires=1141889120
  &x-oss-additional-headers=host
  &x-oss-signature=8u**a3 HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Tue, 20 Dec 2022 08:48:18 GMT

If the server returns a StringToSign value in the response, verify that it matches the string you signed before computing x-oss-signature.

References