0002-00000502

Updated at:

Problem description

The format of the Date or x-oss-date request header is invalid.

Causes

The value of the Date request header is not in GMT format, or the value of the x-oss-date request header is not in ISO8601 format.

Problem Examples

You sent a request signed with a V4 signature.

  • Example 1

    GET /oss.jpg?x-oss-signature-verion=OSS4-HMAC-SHA256&x-oss-credential=LTAI****************&x-oss-additional-headers=host&x-oss-signature=8u**** HTTP/1.1
    Host: oss-example.oss-cn-hangzhou.aliyuncs.com
    x-oss-date: Tue, 20 Dec 2022 08:48:18 GMT

    The x-oss-date field must be in the ISO8601 format, such as 20221220T084818Z. In this example, the value of the field is Tue, 20 Dec 2022 08:48:18 GMT, which is an invalid format.

  • Example 2

    GET /oss.jpg?x-oss-signature-verion=OSS4-HMAC-SHA256&x-oss-credential=LTAI****************&x-oss-additional-headers=host&x-oss-signature=8u**** HTTP/1.1
    Host: oss-example.oss-cn-hangzhou.aliyuncs.com
    Date: 20221220T084818Z

    The Date request header must be in GMT format, such as Tue, 20 Dec 2022 08:48:18 GMT. In this example, the value of the request header is 20221220T084818Z, which is an invalid format.

Solutions

  • Set the value of the x-oss-date field to 20221220T084818Z.

    GET /oss.jpg?x-oss-signature-verion=OSS4-HMAC-SHA256&x-oss-credential=LTAI****************&x-oss-additional-headers=host&x-oss-signature=8u**** HTTP/1.1
    Host: oss-example.oss-cn-hangzhou.aliyuncs.com
    x-oss-date: 20221220T084818Z
  • Set the value of the Date field to Tue, 20 Dec 2022 08:48:18 GMT.

    GET /oss.jpg?x-oss-signature-verion=OSS4-HMAC-SHA256&x-oss-credential=LTAI****************&x-oss-additional-headers=host&x-oss-signature=8u**** HTTP/1.1
    Host: oss-example.oss-cn-hangzhou.aliyuncs.com
    Date: Tue, 20 Dec 2022 08:48:18 GMT
Note

You can use an SDK to send requests and implement v4 signing. For more information, see Overview of sending requests with Alibaba Cloud SDKs.

References

  • If you want to implement v4 signing yourself, you can refer to the SDK implementation. For more information, see Python SDK v4 signature implementation.

  • If you want to implement the signing logic yourself, you can refer to v1 signing. For more information, see Overview.