After you upload an object to a bucket in OSS, a URL is generated for the object. You can use this URL to access the object in the bucket. To access an uploaded object through a custom domain name, you must bind the custom domain name to the bucket that contains the object and add a CNAME record that points to the public endpoint of the bucket.
|Console||A user-friendly and intuitive web application|
|OSS SDK for PHP||SDK demos for various programming languages|
|OSS SDK for Node.js|
|OSS SDK for Browser.js|
|OSS SDK for Ruby|
- Custom domain name: the domain name that you purchase from a DNS service provider.
- OSS endpoint or bucket endpoint: the domain name that OSS assigns to your bucket. You can use this domain name to access resources in your bucket. To access an OSS bucket through a custom domain name, you must bind the domain name to the OSS endpoint and add a CNAME record to Alibaba Cloud Domain Name System (DNS).
- Accelerate endpoint: the transfer acceleration-based domain name that OSS assigns to your bucket after transfer acceleration is enabled. You can use accelerate endpoints to accelerate the access to resources in your bucket. Accelerate endpoints are especially suitable when you access data over long distance from different countries or continents. For more information about transfer acceleration, see Transfer acceleration.
For example, User A has a website with the
img.abc.com domain name and the website contains an image with the
http://img.abc.com/logo.png URL. To simplify management, User A wants to redirect all requests for the image
to OSS without modifying the code or the image URL. In this case, User A can bind
a custom domain name to the image object. The process is as follows.
- User A creates a bucket named abc-img in OSS and uploads the image to the bucket.
- User A binds the custom domain name
img.abc.comto abc-img in the OSS console.
img.abc.comis bound to abc-img, OSS maps the custom domain name to the bucket.
- User A adds a CNAME rule on the DNS server to map
abc-img.oss-cn-hangzhou.aliyuncs.com, which is the OSS endpoint of abc-img.
- After receiving a request for
http://img.abc.com/logo.png, OSS redirects the request to abc-img based on the mapping relationship between
img.abc.comand abc-img. Users who attempt to access the image URL
http://img.abc.com/logo.pngare redirected to
The following table compares how the object is accessed before and after the custom domain name is bound.
|Before the custom domain name is bound||After the custom domain name is bound|
- To bind an accelerate endpoint, see Bind accelerate endpoints.
- To access OSS resources from a static web page, see Configure static website hosting and Tutorial: Configure static website hosting through a custom domain name.
- To access OSS resources over HTTPS, see Host SSL certificates.