Help Center > Object Storage Service > Developer Guide > Static Website Hosting > Binding User-Defined Domain Names

Binding User-Defined Domain Names

If you have storage resources in OBS and want to use your own domain name to access these resources or to host static websites, you can define a domain name.

To use a user-defined domain name, ensure that:

  • You have registered the domain name in a third-party domain name registration provider.
  • You own a bucket whose name is the same as the domain name in OBS.
  • You have configured a Canonical Name (CNAME) record for the domain name in a third-party DNS.

How to Use a User-Defined Domain Name

  1. Register a domain name, such as www.example-bucket1.com, in a domain name register provider.
  2. Create a bucket whose name is the same as the domain name (for example www.example-bucket1.com) in OBS. Upload object index.html into the bucket for the use of subsequent static website hosting.
  3. In a third-party DNS server, configure the CNAME record for the user-defined domain name and regional domain name. If bucket www.example-bucket1.com is in region region1.example.com, the configured CNAME record is:

    www.example-bucket1.com. CNAME region1.example.com.

    The method for configuring the CNAME record varies with the DNS provider. For details, contact the corresponding DNS provider.

  4. In a browser, enter user-defined domain name www.example-bucket1.com. The objects in the bucket will be listed.
  5. If you want to use static website hosting, you need to enable static website hosting in the bucket.
  6. In a browser, enter user-defined domain name www.example-bucket1.com. The index.html page is displayed.

Precautions

  1. If no HOST field is in the HTTP (except HTTP 1.0) request header, OBS does not allow user-defined domain names.
  2. If static website hosting has been enabled, regardless of whether the endpoint of the CNAME record is the endpoint of the static website hosting or not, OBS responds in the same way as in static website hosting when you access the domain name. For example, if you have enabled static website hosting for bucket www.example-bucket.com, and have configured the CNAME record of the domain name you defined and OBS domain name in the DNS server. When you send GET /homepage.txt HTTP/1.1 Host: www.example-bucket.com, OBS responds in the same way as in static website hosting.
  3. Users need to configure the domain name mapping on a third-party DNS server.
  4. To use the user-defined domain name to access OBS, if the value of the HOST field in the HTTP request header is an IP address, the request is processed as a standard OBS request.
  5. To use the user-defined domain name to access OBS, if the value of the HOST field in the HTTP request header is localhost, the request is processed as a standard OBS request.
  6. If the bucket name is the internal domain name of OBS, including internal and external domain names of static website hosting, the request is not processed as the user-defined domain name.
  7. A user-defined domain name cannot be accessed through HTTPS.
Registration