Skip to content

Cloudflare for SaaS

Cloudflare for SaaS facilitates proxying a site through Cloudflare without requiring Cloudflare to be the name server for the domain.

Considerations

This requires a CNAME record from the website domain to Cloudflare. As some DNS providers do not allow a CNAME record to be created for an apex domain, the website may need to be served on a www subdomain.

If the customer or a 3rd party manages the website DNS records, tight communication will be required to ensure a minimum of downtime.

Setup

Create a subdomain in Cloudflare

In Cloudflare, go to the morphsites.net domain > DNS > Records and create a new subdomain. The subdomain should be named according to the website domain, with dots replaced with underscores, e.g. app.example.com becomes app_example_com. Ensure proxying is enabled.

Configure the Forge site

Add the Cloudflare subdomain (e.g. app_example_com.morphsites.net) as an alternative domain for the site in Forge.

Regenerate the LetsEncrypt certificate to ensure it includes the Cloudflare subdomain.

Verify the site is now accessible via the Cloudflare subdomain.

Create a custom hostname in Cloudflare

In Cloudflare, go to SSL/TLS > Custom Hostnames and hit 'Add Custom Hostname'.

  • Set 'Custom Hostname' to the website domain, e.g. app.example.com
  • Select 'Customer origin server' and enter the fully qualified subdomain you just created, e.g. app_example_com.morphsites.net

Update DNS

Add a CNAME record for the website domain, pointing to the fully qualified Cloudflare subdomain, e.g.

app.example.com CNAME app_example_com.morphsites.net

Add the TXT records (there may be more than one) listed by Cloudflare for the ACME challenge:

_acme-challenge.app.example.com TXT "..."
_acme-challenge.app.example.com TXT "..."

TIP

If DNS is managed by a 3rd party, instruct them to perform the above steps.

Once DNS has propagated, hit the refresh button on the custom hostname in Cloudflare and verify there are no errors.