After you upload objects to a bucket, Object Storage Service (OSS) automatically generates URLs for the uploaded objects. You can use these URLs to access the objects. If you want to access the objects by using custom domain names, you must map the custom domain names to the bucket in which the objects are stored and add CNAME records for the custom domain names.

Limits

  • In accordance with the administrative regulations of the People's Republic of China, the custom domain names that you want to map to OSS buckets in mainland China regions must be filed at the Ministry of Industry and Information Technology (MIIT) in advance.

    For more information about how to file a domain name, visit Alibaba Cloud ICP Filing system.

  • Up to 100 domain names can be mapped to a bucket. Each domain name can be mapped to only one bucket. OSS does not impose limits on the number of domain names that can be mapped by using an Alibaba Cloud account.
  • When you map a custom domain name to a bucket in the OSS console, the domain name cannot contain wildcards. When you map an accelerated domain name to a bucket by using Content Delivery Network (CDN), the domain name can contain wildcards but is not displayed in the OSS console.

Scenarios

  • When you use a browser to access image objects in buckets created in mainland China regions after September 23, 2019, make sure that the objects can be previewed instead of downloaded.
  • When you access a bucket for which static website hosting is configured, make sure that you do not access the bucket by download.

Implementation methods

You can map custom domain names to a bucket in the OSS console. For more information, see Map custom domain names.

Usage notes

For example, a public read object named exampleobject.jpg is stored in the root directory of the bucket named examplebucket in the China (Hangzhou) region. A custom domain name www.example.com is mapped to the bucket. You can access the object by using different URLs before and after the custom domain name is mapped to the bucket.
  • Before the custom domain name is mapped to the bucket

    You can use the following URL that contains the default domain name of the bucket to access the exampleobject.jpg object: https://examplebucket.oss-cn-hangzhou.aliyuncs.com/exampleobject.jpg.

  • After the custom domain name is mapped to the bucket

    You can use the following URL that contains the custom domain name mapped to the bucket to access the exampleobject.jpg object: https://www.example.com/exampleobject.jpg.

    Note After a custom domain name is mapped to a bucket, you can preview an object in the bucket, and the object is not downloaded as an attachment when you use the object URL of the image. If the object cannot be previewed but is downloaded as an attachment, the possible cause is that the browser does not support previews for some image formats. To solve this issue, you must install a plug-in that allows your browser to preview objects of the corresponding format.

References