Symptoms
When uploading or downloading objects using a default Object Storage Service (OSS) public domain name, such as oss-cn-hangzhou.aliyuncs.com, the operation fails with the following error:
PublicEndpointForbidden: Not allowed using the OSS public endpoint, please use CNAME insteadCause
Starting March 20, 2025, Alibaba Cloud restricts data API calls that use a default OSS public domain name in the Chinese mainland. Affected operations include uploading and downloading objects. You must use a custom domain name (CNAME) to access OSS instead of the default public domain name.
For details on this policy change, see Notice on Policy Change for Calling Data APIs Using Default OSS Public Domain Names in the Chinese mainland.
Solution
Map a custom domain name to your OSS bucket to replace the default public domain name.
Follow the steps in Access OSS using a custom domain name to configure a CNAME record that points your custom domain name to the bucket's default domain name.
If your workload involves long-distance data transfers or cross-region access, enable transfer acceleration on the bucket. This feature uses smart routing and protocol optimization to resolve issues such as high network latency and unstable transmission, which improves data transfer efficiency and the access experience.