0002-00000401

更新时间:
复制 MD 格式

Problem description

The Authorization header in the request is blank.

Causes

The request uses an Amazon S3-compatible V4 signature (AWS Signature Version 4), but the Authorization header has no value.

Examples

The following request triggers this error. The Authorization header is present but blank, so OSS rejects the request.

GET /test.txt HTTP/1.0
Date: Tue, 20 Dec 2022 08:48:18 GMT
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Authorization:
x-amz-content-sha256: abc***
x-amz-date: 20221220T084818Z
x-oss-s3-compat: true

Solutions

Include a valid value in the Authorization header. The value must follow the AWS Signature Version 4 format:

Authorization:AWS4-HMAC-SHA256 Credential=<access-key-id>/<date>/<region>/s3/aws4_request,SignedHeaders=<signed-headers>,Signature=<signature>

The following table describes each component:

ComponentDescriptionExample
AWS4-HMAC-SHA256The signing algorithm. Required for AWS Signature Version 4.AWS4-HMAC-SHA256
CredentialYour access key ID followed by the credential scope: <access-key-id>/<date>/<region>/s3/aws4_requestLTAI****************/20221220/us-east-1/s3/aws4_request
SignedHeadersA semicolon-separated list of headers included in the signature.host;x-amz-content-sha256;x-amz-date
SignatureThe HMAC-SHA256 signature of the request.34****

The following is an example of a correctly signed request:

GET /test.txt HTTP/1.0
Date: Tue, 20 Dec 2022 08:48:18 GMT
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Authorization:AWS4-HMAC-SHA256 Credential=LTAI****************/20221220/us-east-1/s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-date,Signature=34****
x-amz-content-sha256: abc****
x-amz-date: 20221220T084818Z
x-oss-s3-compat: true

To avoid manual signing errors, use an Amazon S3 SDK to construct and sign requests automatically. The SDK generates a valid Authorization header. For setup instructions, see Use Amazon S3 SDKs to access OSS.