You can bind a custom domain name to your OSS bucket in the OSS console and then add a CNAME record in the Domain Name System (DNS). After the CNAME resolution, OSS automatically processes the access requests to the custom domain name.
Suppose that John has a website with the domain name abc.com in Hangzhou. The website contains a page with the link
http://img.abc.com/logo.png. John wants the requests for
http://img.abc.com/logo.png to be serviced from the OSS content. CNAME is particularly well suited for this scenario. The process is as follows:
- John creates a bucket named abc-img in China East 1 (Hangzhou), and uploads the image logo.png.
- John binds the domain name
img.abc.comto the bucket abc-img in the OSS console.
- OSS maps the domain name
img.abc.comto the bucket abc-img.
- John adds a CNAME record in the Domain Name System (DNS) to map the domain name
img.abc.comto the OSS domain name of the bucket abc-img, that is,
- When the request for
http://img.abc.com/logo.pngis sent, OSS resolves the mapping between img.abc.com and abc-img, and directs the request to
The comparison between the process before CNAME resolution and that after CNAME resolution is as follows:
|Before CNAME resolution||After CNAME resolution|
For more information about how to bind a custom domain name in the OSS console, see Manage a domain name in the OSS Console User Guide.