0002-00000504

更新时间:
复制 MD 格式

Problem description

The difference between the timestamp in your signed request and the time OSS received the request is too large.

Causes

The timestamp in your signed request is outside the allowed time window. The time parameter in the request may be the Date header or x-amz-date header.

This time restriction exists to prevent replay attacks: a signed request captured by an attacker becomes useless once the window expires.

Examples

The following request was signed with a Date of December 20, 2020. If OSS receives this request in 2022, the time difference is far outside the allowed window and OSS returns this error.

GET /test.txt HTTP/1.0
Date: Tue, 20 Dec 2020 08:48:18 GMT
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Authorization: OSS LTAI****************:UNQD*************************

Solutions

Make sure that the value of the Date or x-amz-date header in the request is valid and reflects the current time when sending the request.

If your HTTP library sets Date automatically and does not let you override it, use x-amz-date instead. OSS accepts either header as the request timestamp.

Check that your system clock is synchronized. A clock that has drifted causes every signed request to fail. Use NTP to keep your system time accurate.

We recommend using Alibaba Cloud SDKs to send requests. SDKs generate and attach timestamps automatically, so you never need to calculate them manually. For more information, see Overview.