copyright | lastupdated | keywords | subcollection | ||
---|---|---|---|---|---|
|
2024-04-19 |
routing rules for cloud-object-storage, static website domains for cloud-object-storage, domains for cloud-object-storage |
cloud-object-storage |
{{site.data.keyword.attribute-definition-list}}
{: #routing-rules-cos}
A static website hosted with {{site.data.keyword.cos_full}} can be configured using {{site.data.keyword.cis_full_notm}}. Configuring routing rules for domains hosted in {{site.data.keyword.cos_full_notm}} will be explored in this advanced "how to." {: shortdesc}
These instructions are subject to change and are provided here for review. {: important}
{: #routing-rules-cos-overview}
When hosting static website content on {{site.data.keyword.cos_full_notm}}, you can configure how the public accesses your site by specifying a custom domain. Using {{site.data.keyword.cis_full_notm}} configures {{site.data.keyword.cos_short}} 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 {{site.data.keyword.cis_short}}, and a desired subdomain, web
that you wish your public visitors to view as web.example.com
.
{: #routing-rules-cos-prerequisites}
Prerequisites:
- An account for the {{site.data.keyword.cloud_notm}} Platform
- An instance of {{site.data.keyword.cis_short}} with an applicable plan and permissions
- An instance of {{site.data.keyword.cos_short}} with a bucket configured as a hosted static website
- An Internet domain managed through {{site.data.keyword.cis_full_notm}}
These instructions require an account with the correct plan in order to access the services as described. {: note}
{: #routing-rules-cos-cis}
{: #routing-rules-cos-page-rule}
Creating a "Page Rule" in your instance of {{site.data.keyword.cis_full_notm}} will take several steps, and require your endpoint information
-
Select Performance from the Navigation
-
Select the Page rules Tab from the options.
-
In the table of rules (empty if this is the first), Select the "Create rule" button.
-
In the URL match field Enter
<sub-domain>.<custom-domain>/*
. For example,web.example.com/*
. -
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, usingweb-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. {: note}
-
When you have confirmed your configuration options, select "Create."
-
Next, you will create the DNS CNAME record to forward traffic to your content in {{site.data.keyword.cos_full_notm}}.
{: #routing-rules-cos-domain-alias}
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
-
Select Reliability from the Navigation
-
Select the DNS Tab from the options.
-
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
-
Click "Add" to save the DNS entry when you've completed the configuration.
-
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.
{: #routing-rules-cos-steps}
Learn more about {{site.data.keyword.cis_full_notm}}, or jump right in using {{site.data.keyword.cis_short}} to get started managing your presence on the Internet.