Problem description
Your V4 signature request is rejected because the <Region> value in x-oss-credential is invalid or does not match the region in the Host header.
Causes
Two misconfigurations trigger this error:
Cause 1: Invalid `<Region>` value in `x-oss-credential`
The <Region> segment uses the OSS endpoint format (oss-cn-hangzhou) instead of the region ID format (cn-hangzhou). The oss- prefix is not valid in this field.
Cause 2: `<Region>` mismatch between `x-oss-credential` and `Host`
The region embedded in the Host header (oss-<region-id>.aliyuncs.com) does not match the <Region> value in x-oss-credential. Both must refer to the same region.
Examples
Example 1: Invalid `<Region>` in `x-oss-credential`
The credential uses oss-cn-hangzhou as the <Region> value. This is invalid because the oss- prefix is not allowed in this field.
GET /oss.jpg?x-oss-signature-verion=OSS4-HMAC-SHA256&x-oss-credential=AK**ID/2024-11-13/oss-cn-hangzhou/oss/abc&x-oss-expires=1141889120&x-oss-additional-headers=host&x-oss-signature=8u**a3 HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Wed, 13 Nov 2024 08:48:18 GMTThe <Region> in x-oss-credential must be cn-hangzhou, not oss-cn-hangzhou.
Example 2: Region mismatch between `Host` and `x-oss-credential`
The Host header points to oss-cn-shenzhen, but x-oss-credential specifies cn-hangzhou.
GET /oss.jpg?x-oss-signature-verion=OSS4-HMAC-SHA256&x-oss-credential=AK**ID/2024-11-13/cn-hangzhou/oss/abc&x-oss-expires=1141889120&x-oss-additional-headers=host&x-oss-signature=8u**a3 HTTP/1.1
Host: oss-example.oss-cn-shenzhen.aliyuncs.com
Date: Date: Wed, 13 Nov 2024 08:48:18 GMTBoth values must refer to the same region.
Solutions
Set the <Region> values as follows:
| Field | Required format | Example |
|---|---|---|
x-oss-credential | Region ID without the oss- prefix | cn-hangzhou |
Host | OSS endpoint format with the oss- prefix | oss-cn-hangzhou |
The region ID in x-oss-credential and the region embedded in Host must match.
References
For a list of OSS region IDs and their corresponding endpoints, see OSS regions and endpoints.