DNS cname to cloudflare pages preview url doesn't work

Trying to configure a cname to a preview branch in Cloudflare pages…

We have a staging branch in github and when pushing to it, it deploys. While a new preview URL is always created, Cloudflare has a static URL like staging.myproject.pages[dot]dev

When I try to add a CNAME to my DNS to point to the staging url (staging.mydomain[dot]com), I always get a 522 timeout at the Host step from Cloudflare. Is there any way to make this work?

You have to make Pages answer to the new custom domain, same as any other web server. For a preview you then manually change the created CNAME to point to the branch deployment. Right now, doing this for a preview branch requires that you have your DNS on Cloudflare.