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.

Usage notes

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

    For more information, see What is an ICP filing?.

  • 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 to 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, the domain name can contain wildcards but is not displayed in the OSS console.

Scenarios

  • For image objects in a bucket created in mainland China regions after September 23, 2019, if you want to make sure that the image objects are previewed instead of downloaded when the objects are accessed by using a browser, map a custom domain name to the bucket.
  • If you want to make sure that a bucket for which static website hosting is configured is not downloaded when the bucket is accessed, map a custom domain name to the bucket.

Implementation methods

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

Examples

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. The custom domain name www.example.com is mapped to the bucket. Then, the URL of the bucket changes after the custom domain name is mapped.
  • 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 image object in the bucket when you access the image object, and the object is not downloaded as an attachment. If the object cannot be previewed but is downloaded as an attachment, the cause may be 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