Mapping cnames from external DNS to Branch aliases

Is it possible to map custom subdomains for branches, like to, if lies on an external DNS?
We’ve tried this for a project that we recently migrated to pages and we only ever got the production build, not the one for the branch.
Using a domain we purchased here on Cloudflare this works pretty much instantly, once you change the automatically created DNS-entries. This way we can map all the different builds to separate custom domains.

Problem is, we need to use our main domain from an external DNS.
So is there any additional steps to get this to work?

1 Like


So yes you can do this. You will need to create it in Custom Domains (so add and then at your DNS provider add a CNAME pointing to The UI will tell you to add but you can actually just point it to (though you may need to edit it after it’s validated - not sure with external providers)

Thanks for the quick reply!
We did point the entries directly to the branch alias (also tried first setting and then and verified them via /dig. All the subdomains delivered the production build. When using the aliases directly the builds differed for each branch, we made sure of that.

Still can’t get this to work.
Any hints on what we could check or do differently?

What part doesn’t work and could you share the domain?

Getting the correct build for the non-production branch does not work.

Our entries for the main branch are as follows:
Cloudflare: to
External: to

The version number can be checked at the bottom of the sidebar (lower left corner). The production branch has version 2.6.0, while the main branch has 2.6.1. The domain on the CF-DNS points to the correct version, while the domain on the external DNS points to the production version, although the branch alias is the same.

Here’s the process I use.

The first step in any case is making a commit on your branch so it triggers a build.


Setup a custom domain.

Go into your zone, go into DNS and edit the new record to include the branch. In my case,


Then just visit your new record - i.e

1 Like

May be a good tutorial for the docs if you’re up for it :slight_smile:

(we will support this natively at some point but for now a tutorial in the docs would be awesome)

1 Like

This process does not work for the domain on the external DNS, which seems to be a bug. We cannot move the domain from the external DNS to Cloudflare DNS atm.
As i wrote above, the domain on Cloudflare ( maps perfectly fine, but this does not help sadly.

@Walshy @KianNH any movement on this? We’re facing the same issue.

It’s available on Adding custom branch aliases · Cloudflare Pages docs (my own Pages project) - still needs some refactoring to be fit for merging into the producion documentation.

Edit: Oh, if you mean the fact it doesn’t work with External DNS, then not that I’m aware of. The team are aware though.

Edit (again): Spoken to Walshy and a ticket has been logged so they can investigate it further.


I just hit this issue :facepalm: I suppose it is not possible to track the status of this ticket, is there?

Can confirm that this appears to be a bug. If the DNS is managed by Cloudflare then you can properly do it. :frowning:

Works if managed by Cloudflare DNS

522 error when managed with external DNS