IBM Cloud Docs
Domain Routing for IBM Cloud Object Storage static website hosting

Domain Routing for IBM Cloud Object Storage static website hosting

A static website hosted with IBM Cloud® Object Storage can be configured using IBM Cloud Internet Services. Configuring routing rules for domains hosted in IBM Cloud Object Storage will be explored in this advanced "how to."

These instructions are subject to change and are provided here for review.

Overview

When hosting static website content on IBM Cloud Object Storage, you can configure how the public accesses your site by specifying a custom domain. Using IBM Cloud Internet Services configures Object Storage to modify the HTTP host header in response to public requests of your content. For this example, we will use example.com as the domain configured in Cloud Internet Services (CIS), and a desired subdomain, web that you wish your public visitors to view as web.example.com.

Before you start

Prerequisites:

  • An account for the IBM Cloud Platform
  • An instance of Cloud Internet Services (CIS) with an applicable plan and permissions
  • An instance of Object Storage with a bucket configured as a hosted static website
  • An Internet domain managed through IBM Cloud Internet Services

These instructions require an account with the correct plan in order to access the services as described.

IBM Cloud Internet, Domain, and Delivery Services

Create a Page Rule to target your bucket

Creating a "Page Rule" in your instance of IBM Cloud Internet Services will take several steps, and require your endpoint information

  1. Select Performance from the Navigation

  2. Select the Page rules Tab from the options.

  3. In the table of rules (empty if this is the first), Select the "Create rule" button.

  4. In the URL match field Enter <sub-domain>.<custom-domain>/*. For example, web.example.com/*.

  5. Select from the options for "Rule Behavior Setting" the "Host Header Override." For your custom bucket hosting your static website content as a sub-domain and endpoint: <bucket-name>.s3-web.<bucket-region>.cloud-object-storage.appdomain.cloud. For example, using web-example-com as the name of the bucket hosting your static website, the example would appear as: web-example-com.s3-web.us-east.cloud-object-storage.appdomain.cloud.

    You can find this information in your bucket configuration, or Quick View in the Console.

  6. When you have confirmed your configuration options, select "Create."

  7. Next, you will create the DNS CNAME record to forward traffic to your content in IBM Cloud Object Storage.

Create a domain alias to proxy your content

After you have directed your visitors to the right location using a "Page Rule," you will want to create an alias to guide your visitors to the location. For this example, we want to send your visitors to your new subdomain web to the existing domain, example.com that will point to

  1. Select Reliability from the Navigation

  2. Select the DNS Tab from the options.

  3. Add a new DNS record, substituting your configuration for the exemplified values shown. The desired subdomain should be added in the "name" field. in this example, we used web as a new subdomain value. The "alias domain name" is the same as entered earlier, which in this example comprised a bucket name followed by a dot and then the endpoint, for example, web-example-com.s3-web.us-east.cloud-object-storage.appdomain.cloud.

    • Type: CNAME
    • Name: <sub-domain>
    • TTL: Automatic
    • Alias Domain Name: <bucket-name>.s3-web.<bucket-region>.cloud-object-storage.appdomain.cloud
  4. Click "Add" to save the DNS entry when you've completed the configuration.

  5. In the table of rules where your new entry appears, enable the Proxy option as "on."

To test the rule you just created, allow some time for the configuration to propagate. Then, use a browser to visit the subdomain exemplified by web.example.com to validate the settings.

Next steps

Learn more about IBM Cloud Internet Services, or jump right in using Cloud Internet Services (CIS) to get started managing your presence on the Internet.