Direct all traffic to specific domain through CNAME

So here’s my plan-
I would like to use Cloudflare pages to deploy an angular app that works as a base hub for other domains. I’d like to be able to route my users’ domains to that app, and use the user domain as an id to query my database when someone visits the page. Of course cloudflare pages doesnt give you a ip so A records are off the table for routing their domain.

Plus you can’t have a root CNAME, but I’ve learned you can have a www CNAME that points to the cloudflare pages domain. All I’d then have to do is create a redirect rule from example.comwww.example.com, which would then resolve to my cloudflare pages app.

So my questions-

  1. Does this process seem logical?
  2. Is there a way to add redirect rules through the API?
    This all needs to be automated so I need to create the CNAME record and the redirect rule through the api. Is that possible? I couldnt find information on redirect rules in the api documentation.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.