0002-00000078

更新时间:
复制 MD 格式

Problem description

A signed URL request fails because the x-oss-additional-headers parameter lists headers that are absent from the actual request, or includes headers with underscores (_).

Causes

The error occurs for one of two reasons:

  • A header listed in x-oss-additional-headers does not exist in the actual request headers.

  • A header name in x-oss-additional-headers contains underscores (_).

Examples

In the following request, range is listed in x-oss-additional-headers but is not sent as a request header:

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

Solutions

  1. Remove underscores from header names. Make sure no header listed in x-oss-additional-headers contains underscores (_).

  2. Remove headers that are not sent in the request. Delete any header from x-oss-additional-headers that does not appear in the actual request headers. In the corrected request below, range is removed from x-oss-additional-headers:

    GET /test.txt?x-oss-signature-version=OSS2&x-oss-additional-headers=host&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
Note

You can use an SDK to send requests. SDKs automatically sign your requests. For more information, see Use Alibaba Cloud SDKs to initiate requests.