Custom Domain
If you are using the Arvancloud Object Storage product, you may need to access your files with a domain address other than the default storage address. The Object Storage's "Custom Domain" feature allows you to share your files through your own domain name. Also, this feature is available to you by applying settings in the CDN service user panel.
By default, the Arvancloud Object Storage uses the Arvancloud CDN and defines a subdomain of the main domain (s3.{region}.arvanstorage.ir) for creating each bucket. When a custom domain is defined for a bucket, as shown in the image below, DNS checks the user's request and returns the record (ANAME, CNAME) related to the request to the CDN, and after changing the host header from the custom domain to the bucket's domain, it sends the request to the Object Storage.
In this guide, we will examine two methods for custom domain settings in the Object Storage.
First Step: Domain Registration in Arvancloud CDN
The address format of the files in the Arvancloud Object Storage is a combination of the bucket name, the Arvancloud domain, and the file name. For example, if we upload a file called arvan.png in the arvan-test bucket, we must access this file through the path arvan-test.s3.ir-thr-at1.arvanstorage.ir/arvan.png.
To set up a custom domain on Arvancloud, you need to first register your domain in the CDN section of the Arvancloud user panel. Note that to activate a custom domain in Object storage, you must activate the HTTPS protocol on the domain using a personal certificate or Arvancloud's free SSL certificate.
Second Step: Bucket Custom Domain Activation
After registering the domain in the Arvancloud CDN, you can use the Object Storage user panel to activate the "Custom Domain" feature for your bucket. First, create the bucket you want, and then select the option "Custom Domain" from the operation option of the bucket.
On the new page, you can check the list of dedicated domains defined for the mailbox and click on the "Add New Custom Domain" option to define a new domain.
As you can see in the picture, on the newly opened page, you will need to select the address of the bucket, the domain registered in the Arvancloud CDN, and specify the subdomain.
Choosing the Bucket Address: In this section, you must choose one of the bucket addresses. Each bucket has different domains.
Primary Domain Address: By default, each mailbox connects to the primary Object Storage domain address, which is (s3.{region}.arvanstorage.ir).
Static website domain address: If the static website feature is enabled on the box, you can use the static website address of the box, which is (s3-website.{region}.arvanstorage.ir).
Selecting the Domain Registered in Arvancloud: In this section, you must select the domain you want to connect to the bucket. Note, that if the domain's HTTPS is not activated, an activation warning will be displayed for you.
If you want to connect the root domain to the mailbox, after selecting the domain, click Create to apply the DNS settings for the domain. According to the settings applied to the root domain, in the CDN user panel of your domain, an ANAME record will be created with the value of the bucket address, which you can view from the DNS records section of the CDN panel. You can also create this record for the bucket in the CDN panel independently without using this feature.
In this case, pay attention to the following:
The cloud icon of this record must be active.
Through the edit option in this record, you need to change the Host Header of the record to the value of the record i.e. (bucketname.s3.{region}.arvanstorage.ir).
Note that changing the Host Header to the Arvancloud Object Storage address is free for CDN Basic Plan accounts.
To learn more about the types of DNS records of Arvancloud, refer to the Adding DNS Records guide of Arvancloud CDN.
Determining the subdomain: If you want to connect your subdomain to the bucket, just enable the subdomain determination function, then enter the name of the subdomain in the box in front of it and click the create option.
In this case, a CNAME record will be created in the DNS records section of the content distribution network, which will be possible to view or edit this record through the CDN panel, according to the previous section.
If you need to edit or delete your own domain, you can apply the desired changes through the dedicated domains section of the cloud box or the DNS record settings of the desired domain in the content distribution network panel.