After uploading an object to a bucket, you can obtain an object address including two parts: an OSS domain name address (<BucketName>.<Endpoint>) and an object file name. To avoid possible cross-origin or security problems in your business, we recommend that you access OSS using a user-defined domain name. After the domain name is successfully bound, you also need to add a CNAME record pointing to the Internet domain name of the bucket to ensure proper domain name-based access to the OSS.
- You must apply for an ICP license for your bound domain name. Otherwise, the domain name will not be accessible.
- Each bucket can be bound with a maximum of 20 domain names.
After a user-defined domain name is successfully bound, access addresses of the files stored in your OSS will use the user-defined domain name. For example, if your bucket test-1-001 is located at the Hangzhou node, the object file name is test001.jpg, and the bound user-defined domain name is hello-world.com, then the access address of this object is as follows:
- Before binding: test-1-001..oss-cn-hangzhou.aliyuncs.com/test001.jpg
- After successful binding: hello-world.com/test001.jpg
Go to the OSS console.
Select a bucket to open the Bucket Overview page.
Select Bucket Settings > Domain Management.
Click Add Domain Name.
Enter the domain name you want to bind in the dialog box.
Click Next. The Add Canonical Name page is displayed.
NOTE: If the domain name you want to bind has been maliciously bound by another user, you can verify the ownership of the domain name by adding a TXT record. In this way, the domain name can be forcibly bound to the correct bucket and its binding to the previous bucket is released.
Select the automatic or manual adding method.
Add automatically: The system will automatically add the corresponding CNAME record in the Alibaba Cloud DNS. Make sure you change the domain name’s DNS to Alibaba Cloud DNS if this domain name has not been resolved in Alibaba Cloud DNS already.
Add manually: Select this option if the domain name has already been resolved in the Alibaba Cloud DNS of another account.
Click Finish to complete domain name binding.
Wait for the system to generate a TXT record based on your information.
Log on to your DNS provider and add the corresponding TXT record.
Click Verify on the console. If the system detects that the TXT record value for this domain name is as expected, the domain name ownership passes verification.