Note:
- This tutorial requires access to Oracle Cloud. To sign up for a free account, see Get started with Oracle Cloud Infrastructure Free Tier.
- It uses example values for Oracle Cloud Infrastructure credentials, tenancy, and compartments. When completing your lab, substitute these values with ones specific to your cloud environment.
Expose Your Static Websites Hosted on Oracle Cloud Infrastructure Object Storage to Cloudflare
Introduction
In the realm of web hosting, static websites have gained popularity for their simplicity, efficiency, and security. With the rise of static site generators like Jekyll, Hugo, and Gatsby, deploying a static website has become even more accessible to developers and content creators. However, to enhance performance, security, and reliability, integrating a static website with a content delivery network (CDN) is highly recommended. You can follow the same steps to add your website to any CDN provider of your choice. In this tutorial, we will walk through the steps to add a statically hosted website to Cloudflare.
Objectives
- Expose your static websites hosted on Oracle Cloud Infrastructure Object Storage to Cloudflare.
Prerequisites
-
Static website hosted on an Oracle Cloud Infrastructure (OCI) Object Storage bucket and exposed using OCI API Gateway. For more information, see Set Up OCI Object Storage and Oracle API Gateway for Static Website Hosting.
-
A Cloudflare account - you can select a provider of your choice.
Task 1: Add Your Website
A domain name is the location of a website or application, or what an end user enters into their browser to get to your website. For example: example.com
. We will add the website hosted statically on OCI Object Storage bucket to Cloudflare. For more information, see Add site to Cloudflare.
For this tutorial, we will use domain named openzero.cloud
.
Log in to Cloudflare, click Add a Site and enter your website domain name. Cloudflare will attempt to scan your DNS records automatically.
Task 2: Update the Nameserver
If you have not bought the domain from Cloudflare, you need to update the Cloudflare nameservers in your domain registrar.
Cloudflare will provide you with a set of nameservers. Log in to your domain registrar website and update your domain name servers with the ones provided by Cloudflare. For more information, see Change nameservers.
Task 3: Verify DNS Records
Review the DNS records detected by Cloudflare to ensure accuracy. If necessary, make adjustments or add missing records manually.
Next, we need to add a CNAME record to Cloudflare DNS records that points to your API Gateway on OCI that exposes your static website bucket.
-
Click on your site name, navigate to DNS and Records.
-
Click Add Record and enter the following information.
- Type:
CNAME
. - Name:
@
. - Target:
<Your API Gateway Hostname>
, you can get the hostname of your API Gateway from the OCI Console.
- Type:
-
Click Save.
Task 4: Wait for DNS Propagation
After updating the nameservers and DNS records, DNS propagation will occur. This process can take some time, typically ranging from a few minutes to a few hours.
Task 5: Configure SSL/TLS Encryption
Once DNS propagation is complete, return to the Cloudflare dashboard and configure SSL/TLS encryption settings.
Click on your site name, navigate to SSL/TLS and Overview. For this tutorial, select Full.
Task 6: Test the Domain URL
Retrieve the domain URL and enter it into your browser, this should open your application on the specified domain
Related Links
Acknowledgments
- Author - Mayank Kakani (OCI Cloud Architect)
More Learning Resources
Explore other labs on docs.oracle.com/learn or access more free learning content on the Oracle Learning YouTube channel. Additionally, visit education.oracle.com/learning-explorer to become an Oracle Learning Explorer.
For product documentation, visit Oracle Help Center.
Expose Your Static Websites Hosted on Oracle Cloud Infrastructure Object Storage to Cloudflare
F93833-01
February 2024
Copyright © 2024, Oracle and/or its affiliates.