Is it possible to map custom subdomains for branches, like
mydomain.com 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?
So yes you can do this. You will need to create it in Custom Domains (so add
dev.example.com) and then at your DNS provider add a CNAME pointing to
develop.project.pages.dev. The UI will tell you to add
project.pages.dev but you can actually just point it to
develop.project.project.dev (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
project.pages.dev and then
alias.project.pages.dev) 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: dashboard-dev.powerbot.cloud to main.pb-dashboard.pages.dev
External: dashboard-dev.powerbot-trading.com to main.pb-dashboard.pages.dev
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
May be a good tutorial for the docs if you’re up for it
(we will support this natively at some point but for now a tutorial in the docs would be awesome)
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 (powerbot.cloud) 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 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.
Works if managed by Cloudflare DNS
522 error when managed with external DNS