Note:

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

Prerequisites

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.

After Adding Site

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.

  1. Click on your site name, navigate to DNS and Records.

    Dns/Records Page

  2. 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.

    API Gateway hostname

  3. Click Save.

    Add Dns Form

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.

SSL/TLS Setup

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

Your Website On A Live Domain

Acknowledgments

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.