0002-00000219

更新时间:
复制 MD 格式

Problem description

A V4 signed request to OSS failed because the x-oss-signature header is missing.

Causes

The request includes V4 signature parameters (such as x-oss-signature-verion=OSS4-HMAC-SHA256) but omits the required x-oss-signature header, which carries the computed signature value.

Examples

The following request contains x-oss-signature-verion, x-oss-credential, and x-oss-expires, but is missing x-oss-signature:

GET /oss.jpg?x-oss-signature-verion=OSS4-HMAC-SHA256&x-oss-credential=***&x-oss-expires=1141889120&x-oss-additional-headers=host HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Tue, 20 Dec 2022 08:48:18 GMT
Note: Line breaks are added for readability. In practice, all parameters appear in a single query string.

Solutions

Include all required fields in the request. The following shows a complete, valid V4 signed request:

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

Required fields

ParameterRequiredDescription
x-oss-signature-verionYesSigning algorithm identifier. Set to OSS4-HMAC-SHA256 for V4 signatures.
x-oss-credentialYesYour access key ID combined with the credential scope, in the format <AccessKeyId>/<date>/<region>/oss/aliyun_v4_request. For example: LTAI****************/20221220/cn-hangzhou/oss/aliyun_v4_request.
x-oss-expiresYesSignature expiration time.
x-oss-signatureYesThe calculated signature value. This is the field that was missing from the request.
x-oss-additional-headersNoAdditional headers included in the signature calculation.

If the server returns a response that contains the StringToSign parameter, compare it against the string you used as input before signing. A mismatch indicates a signing logic error.

References