0002-00000076

更新时间:
复制 MD 格式

Problem description

The x-oss-additional-headers field in a signed URL is blank.

Causes

A signed URL is used to send a request, but the x-oss-additional-headers field in the URL parameter is left empty.

Examples

The following request includes x-oss-additional-headers= with no value, which triggers the error:

GET /test.txt?x-oss-signature-version=OSS2&x-oss-additional-headers=&x-oss-access-key-id=44CF9***&x-oss-expires=1475462111&x-oss-signature=abc*** HTTP/1.0
Date: Tue, 20 Dec 2022 08:48:18 GMT
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Range: bytes=100-900

Solutions

Choose one of the following based on whether you need to include additional headers in the signature:

Option 1: Remove the parameter

If you do not need additional request headers in the signature calculation, delete x-oss-additional-headers from the URL entirely.

Option 2: Set a valid value

If you do need additional headers in the signature calculation, set x-oss-additional-headers to a correctly formatted value. The value must meet all three requirements:

  • All header names must be lowercase

  • Header names must be sorted in ascending alphabetical order

  • Multiple header names must be separated by semicolons (`;`)

For example, to include the Host and Range headers in the signature for the request above, set the parameter to host;range:

GET /test.txt?x-oss-signature-version=OSS2&x-oss-additional-headers=host;range&x-oss-access-key-id=44CF9***&x-oss-expires=1475462111&x-oss-signature=abc*** HTTP/1.0
Date: Tue, 20 Dec 2022 08:48:18 GMT
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Range: bytes=100-900
Note: To avoid constructing signatures manually, use Alibaba Cloud SDKs. SDKs generate signatures automatically. For more information, see Overview.