0002-00000110

Updated at:

Problem description

The AdditionalHeaders field in the Authorization request header is left empty.

Causes

The request uses a V2 signature, but the AdditionalHeaders field in the Authorization request header is empty.

Examples

The following request uses a V2 signature, but the Authorization request header is invalid.

GET /oss.jpg HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Tue, 20 Dec 2022 08:48:18 GMT
Authorization: OSS2 AccessKeyId:44**07,AdditionalHeaders:,Signature:n7***I0=

A space separates the signature version from the signature information in the Authorization request header:

  • Signature version: Only OSS2 is supported.

  • Signature information: A comma-separated list of key:value pairs.

    Required keys are AccessKeyId and Signature. The AdditionalHeaders key is optional. In this example, all three keys are present but AdditionalHeaders is empty.

Solutions

Set the AdditionalHeaders field in the Authorization header to a valid value.

GET /oss.jpg HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Tue, 20 Dec 2022 08:48:18 GMT
Authorization: OSS2 AccessKeyId:44**07,AdditionalHeaders:host,Signature:n7I**I0=

References

  • To use Alibaba Cloud SDKs to initiate a V2-signed request, see Overview.

  • You can implement the signature yourself.

    When you implement the signature using these methods, if the server returns a StringToSign string in the response, check whether the server-side string-to-sign is the same as the one you used for signing.