How to expose branch preview URL to public domain (branch.myapp.pages.dev -> branch.myapp.com)

Hi folks, I have a staging branch that is is routed to the branch preview URL like this staging.myapp.com -> staging.myapp.pages.dev. How would you do the same for all preview branch urls? I'm looking for something like this: [branchname].myapp.com -> [branchname].myapp.pages.dev.
No description
4 Replies
Chaika
Chaika5w ago
can't do wildcard, have to do one at a time/per branch. Or use a Worker to proxy requests to the pages.dev (would have to pay for each request as a invocation though)
Vlady
Vlady5w ago
Cool, I guess I can make it work with one main staging branch. I added this record, but when I go to this domain https://staging.yupty.live/ I get a 522 error. The pages it points to (https://staging.yupty-front.pages.dev) loads fine
No description
Chaika
Chaika5w ago
you have to add it as a Custom Domain in your Pages Project first and then change the cname it makes for you
Chaika
Chaika5w ago
Cloudflare Docs
Add a custom domain to a branch · Cloudflare Pages docs
In this guide, you will learn how to add a custom domain (staging.example.com) that will point to a specific branch (staging) on your Pages project.
Want results from more Discord servers?
Add your server
More Posts