0002-00000502
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 GMTThe
x-oss-datefield must be in theISO8601format, such as20221220T084818Z. In this example, the value of the field isTue, 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: 20221220T084818ZThe
Daterequest header must be in GMT format, such asTue, 20 Dec 2022 08:48:18 GMT. In this example, the value of the request header is20221220T084818Z, which is an invalid format.
Solutions
-
Set the value of the
x-oss-datefield to20221220T084818Z.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
Datefield toTue, 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
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.