Help Center/ Object Storage Service/ User Guide/ Domain Name Management/ Accessing a Bucket Using a User-Defined Domain Name
Updated on 2026-09-23 GMT+08:00

Accessing a Bucket Using a User-Defined Domain Name

After you upload a file to a bucket, OBS generates an access address for the file that includes the bucket's default domain name. Accessing this address using a browser will automatically download the file. To avoid exposing the default domain name of a bucket or to preview files online through a browser, you can bind a user-defined domain name to the bucket and use it to access the files in the bucket.

Scenarios

  • File preview: To avoid automatic file downloads, you can bind a user-defined domain name to a bucket for online file preview.
  • Keeping the access address unchanged: To keep website or file access addresses unchanged after a migration or storage location change, you can upload the files to a bucket and bind a user-defined domain name to the bucket. This will establish a mapping between the website domain name and the default bucket domain name. In this way, you can still access the files using the original address.
  • Improved brand image: Having a fixed and personalized domain name for accessing an enterprise website can make the enterprise appear more professional and reliable. This enhances enterprise image and improves customer experience.
  • Easy access: You can use a user-defined domain name that is easy to remember to access a bucket and files in the bucket.

How It Works

The following describes the process of accessing objects in a bucket using a user-defined domain name and the process of accessing objects in a bucket using the default bucket domain name.

Figure 1 shows how to use a user-defined domain name to access objects in a bucket.

Figure 1 Using a user-defined domain name to access objects in a bucket

  1. A user enters a file access address (that includes a user-defined domain name) in a browser to initiate an access request.
  2. DNS maps the user-defined domain name to the default domain name of the bucket.
  3. DNS translates the default domain name of the bucket to the IP address of the OBS server.
  4. OBS returns the IP address of the server to the client.
  5. The client sends a request with the user-defined domain name specified in the Host header to the IP address of the OBS server.
  6. OBS identifies the user-defined domain name in the Host header and returns a response with Content-Disposition set to inline to the client, which indicates that the file is expected to be displayed in the browser.

Figure 2 shows how to use the bucket's default domain name (bucketName.obs.regionID.myhuaweicloud.com) to access objects in the bucket.

Figure 2 Using the bucket's default domain name to access objects in the bucket
  1. A user enters a file access address (that includes the default domain name of the bucket) in the browser to initiate an access request.
  2. DNS translates the default domain name of the bucket to the IP address of the OBS server.
  3. OBS returns the IP address of the server to the client.
  4. The client sends a request with the default domain name specified in the Host header to the IP address of the OBS server.
  5. OBS identifies the default domain name in the Host header and returns a response with Content-Disposition set to attachment to the client, which indicates that the file is expected to be downloaded and saved locally.

Constraints

Table 1 Constraints

Item

Description

Bucket version

Only buckets whose version is 3.0 or later support user-defined domain names. To check the version of a bucket, go to OBS Console, click the bucket name and go to the Overview page, and find the version in the Basic Information area.

Number of domain names

By default, a bucket can have up to 20 user-defined domain names bound.

Functions

  • A user-defined domain name can be bound to only one bucket.
  • Chinese domain names are not supported.
  • The suffix of a user-defined domain name can contain 2 to 63 uppercase or lowercase letters.
  • Per MIIT regulations, if your bucket with a user-defined domain name is located in a Chinese mainland region, you must complete an ICP filing in advance.
  • User-defined domain names are typically used for public access to OBS buckets. For intranet access, it is recommended to use the bucket's default domain name (bucketName.obs.regionID.myhuaweicloud.com).
NOTE:

If an acceleration domain name is used, to prevent objects in OBS buckets from being forcibly downloaded when accessed, configure the user-defined domain name and the acceleration domain name, and then perform the required operations described in Why Are Objects Forced to Download When CDN Acceleration Is Enabled?

Permissions

In cross-account scenarios, the APIs for setting, obtaining, or deleting a bucket's user-defined domain name cannot be called. Assume there are two Huawei Cloud accounts. One account cannot configure, obtain, or delete the other's user-defined domain name.

In the same account, you must be the bucket owner or have the permissions to set (obs:bucket:PutBucketCustomDomainConfiguration), obtain (obs:bucket:GetBucketCustomDomainConfiguration), and delete (obs:bucket:DeleteBucketCustomDomainConfiguration) the user-defined domain name. You are advised to use IAM or bucket policies for authorization. For more information about OBS authorization methods, see Differences Between OBS Permissions Control Methods.

Prerequisites

  • There is a bucket with objects. For details, see Creating a Bucket.
  • There is a second-level domain.
  • Per MIIT regulations, if your bucket with a user-defined domain name is located in a Chinese mainland region, you must complete an ICP filing in advance.

Configuring a User-Defined Domain Name

You can use OBS Console, APIs, obsutil, or SDKs to configure user-defined domain names. You cannot use OBS Browser+ to do so.

Specifically, perform the following steps:

  1. Bind a user-defined domain name to the bucket.
  2. Add a CNAME record set to map the user-defined domain name to the default domain name of the bucket.
  3. (Optional) Configure HTTPS to secure access through the user-defined domain name.

Using a User-Defined Domain Name to Access Objects

After a user-defined domain name is bound to a bucket and the domain name resolution is successful, verify that you can use the domain name to access objects. You can use APIs, SDKs, or obsutil to access objects through a user-defined domain name. You cannot use OBS Console or OBS Browser+ to do so.

References