Error when uploading a file: PublicEndpointForbidden: Not allowed using the OSS public endpoint, please use CNAME instead
Symptoms
When you upload a file using a default Object Storage Service (OSS) public domain name, such as oss-cn-hangzhou.aliyuncs.com, the system returns the following error message:
PublicEndpointForbidden: Not allowed using the OSS public endpoint, please use CNAME instead
Cause
Starting March 20, 2025, Alibaba Cloud will restrict data operation API calls that use a default OSS public domain name in the Chinese mainland. These operations include uploading and downloading files. To access the OSS service, you must use a custom domain name (CNAME).
For more information about this policy change, see Notice on Policy Change for Calling Data APIs Using Default OSS Public Domain Names in the Chinese mainland.
Solution
You can map a custom domain name (CNAME) to override the default public domain name for OSS access. For specific configuration steps, see Access OSS using a custom domain name. If your business involves long-distance data transmission or cross-region access, you can also enable the transfer acceleration feature. 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.