CF Pages Preview deploys always have different URLs

According to https://developers.cloudflare.com/pages/platform/preview-deployments :

Preview deployments allow you to preview new versions of your project without deploying it to production.

Every time you open a new pull request on your GitHub repository, Cloudflare Pages will create a unique preview URL, which will stay up-to-date as you continue to push new commits to the branch.

But every preview deployment I build gets a different, random URL. I’ve tried pushing to the same (non production) branch, an also opening a pull request from that branch to the production branch. And then adding a commit to the develop branch while the pull request is open. The pull request shows multiple preview deployments, but with a different URL for each deployment.

Ideally I’d like to associate a branch with a URL (ie develop.example.com for the develop branch). But if that isn’t possible, I’d like to have a unique URL for an open pull request if possible.

Am I misunderstanding how this is supposed to work and if so, is there a way to get static URLs for (some) preview deployments?

Thanks,

Ben

I’m having the same question. This annoys me quite a lot.

My developers are pushing to non-production branches on GitHub and Cloudflare generates a new random URL for each push, how can they (developers) know which URL to access? Given that they are not invited to Cloudflare Dashboard.

Randomized URL should only be used for seeing past builds and there should also be a static URL for each git branch.

Or at least Cloudflare should be able to announce the randomized URL to developers through GitHub or email. I mean we have Cloudflare Access and all, but there’s no way for developers to know the URL?

I’m also frustrated by this because static site builds cannot dynamically change the baseURL property. All my links to other pages in my site are generated by using the Hugo {{ .Permalink }} property of the page. This gets translated based on the baseURL of the site. The baseURL is configurable, and can even be set during the build process with the hugo -b $DEPLOY_URL flag. But unfortunately as Pages works right now, my Hugo site preview has links that all point to the configured baseURL, which is my production URL and not the deployed preview URL.

It would be really nice if Cloudflare allowed access to the DEPLOY_URL in the same way that Netlify does for building static sites with Pages.

Hi everyone,

I know that the team has received this feature request already, especially the custom url per branch. It should be coming, but I have no more info than you have yet. Exposing the URL of the deploy might be good, but I haven’t heard of that yet.

You could join their Discord server, there might be info they will share later.

1 Like