Question

Offer custom domains for my SAAS using DO Apps+Cloudflare

I would like to offer custom domains features for customers of my SaaS tool.

Here’s my initial configuration:

  • SaaS domain mysaas.com hosted on Cloudflare.
  • SaaS app hosted on DigitalOcean App Platform.
  • Another domain clientdomain.com hosted on Cloudflare. I use it for tests.

It looks like the easiest way to achieve this feature is to use Cloudflare’s SSL for SaaS (documentation).

What I have done:

  1. Create a proxied CNAME for the subdomain domain.mysaas.com and connect it to the DigitalOcean’s app. Now I can use this subdomain to access the app. Easy.

  2. From the SSL/TLS > Custom Hostnames add domain.mysaas.com as a Fallback Origin. Also, add custom.clientdomain.com in the hostname section. Custom Hostname

  3. Go to clientdomain.com DNS settings and add: custom.clientdomain.com CNAME domain.mysaas.com. Also add a TXT record to verify the ownership.

I thought that this is enough but it doesn’t work. If I open custom.clientdomain.com I get browser’s 404 status page. I’ve checked the SSL certificate and it looks like it’s the correct one (issued by Cloudflare today).

At the same time, domain.mysaas.com works perfectly.

Is there something I’m missing? Do I need to add an A record for domain.mysaas.com (but DigitalOcean doesn’t provide it)? Could it be related to CORS settings or something?

Any help would be much appreciated! It’s been 3 days I’m trying to resolve this.

Probably there’s a better (not Cloudflare’s) solution?

EDIT: I really think I have to do something on the DigitalOcean side. Add a wildcard accepting any domain somehow…?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there,

There was a similar question asked here:

https://www.digitalocean.com/community/questions/can-i-add-multiple-domains-on-app-platform

It is possible to run multiple domains with App Platform. There are limits to the number of domains allowed by default. If you plan to run a SaaS style app with more than a few dozen, I recommend talking to our support/sales team.

https://www.digitalocean.com/support/

The App Platform also supports wildcard domains (ex. *.example.com) which can be used to ease configuration of lots of subdomains.

Hope that helps!

- Bobby.