Currently we have a cloud based SaaS application, that runs behind a domain on Cloudflare. Let's say example.com.
The main panel and application is located at cloud.example.com
. When a customer signs up, they are allowed to choose a subdomain where they can access the control panel and the front end of the application. Let's say customer.example.com
As example.com is on Cloudflare, a simple call to the Cloudflare API to add a A record is all it takes to have one of these domains setup and Proxying through Cloudflare for all the CDN an DDoS goodness.
We now want to allow customers to provide their own domain, for cosmetic and branding reasons etc. Let's say the user wants to use app.customer.com
, their own domain. In the usual fashion, the customer would be instructed to create a CNAME to map that domain, to the customer.example.com
domain that we generated. But when we do that, we receive a DNS resolution error. Something that is only supported on Cloudflare Enterprise plan.
I feel there are 2 good options to work around this that I can think of:
Create a separate Microservice,
dns.example.com
, that all custom domains are mapped to. Whatever domain is mapped to it, either by using some prefix likecustomer.dns.example.com
or by trying to configure Nginx to take the host and use that. Thisdns.example.com
is in the Cloudflare network but is "DNS Only".Requests hitting this are then mapped to
customer.example.com
(which is on the Cloudflare network and as it shares the same domain including name servers), using a CNAME record. Soapp.customer.com
-> CNAME ->customer.dns.example.com
-> CNAME ->customer.example.com
Benefits of doing it this way means we can take advantage of Cloudflare's proxying, albeit making it a bit complicated.
Use Cloudflare for DNS only. Customers are assigned their subdomain and a simple CNAME from their custom domain to the one assigned to them works fine because of no Cloudflare proxying. With this, take advantage of the host's DDoS protection.
Perhaps serve static files from
static.example.com
, and proxy that on Cloudflare to take advantage of the CDN etc.
My question really boils down to, is not using Cloudflare for their services a good choice in this scenario? Public IPs are Public, hence the name, but is it fine to just have the IP of where the server is running on a public A Name? Plus, I don't want to enforce my customers to have to use Cloudflare to set it up, I want it to be seemless.
Any input, ideas, or designs, please share them!
Quick FYI: SSL Certificates isn't really an issue, either way I have them covered/generated easily.