Having trouble figuring out how to setup staging environment on Pages

I'm migrating a React app from Netlify to Cloudflare pages. My production branch is production and my staging branch is master. I set up a new Cloudflare Pages project building production for my production site and master for my preview site, but the previews are prefixed with the commit SHA. I want my staging site running on a fixed subdomain like staging.mysite.com. I can't figure out how to do this.
2 Replies
Hello, I’m Allie!
master.project.pages.dev should be the latest master commit, if that is what you mean
Tin Cap
Tin CapOP9mo ago
I'm getting something like <commitSHA>-master.project.pages.dev Wait, maybe it's not a commit SHA. Maybe it's just a random unique ID Ok yeah. My production site is something like https://randomID1.project.pages.dev and my staging site is something like https://randomID2.project.pages.dev Based on the tutorials, I was expecting different URL structures, but this works Ooooh, they have aliases I finally figured it out. I found the setup very confusing. I was looking at this documentation: https://developers.cloudflare.com/pages/how-to/custom-branch-aliases/ - It wasn't clear to me that I needed to get the alias of my preview branch, not the unique deploy URL - It wasn't clear that I had to setup the domain in Pages first, then go to the DNS settings to modify it to the preview alias. I tried setting it up in DNS directly and I got an error trying to access the site. - Ideally, the custom domain setup inside Pages should let me choose which deploy I want to use instead of requiring the extra step.
Want results from more Discord servers?
Add your server