Custom Subdomain for git branches

cf pages automatically creates ${branchName}.my-app.pages.dev and that is great but I don't want to expose any *.pages.dev.

my app is deployed at app.mydomain.com and I'd like the alpha or beta branch to be accessible at alpha.app.mydomain.com & beta.app.mydomain.com respectively.

I can add alpha.app.mydomain.com along side app.mydomain.com under the custom domains section but it resolves as an alias of app.mydomain.com and I fail to see how I can choose what deployment is associated to a specific domain.

In case it's any relevant, please note that I build my next app on a self-hosted ci using npx @cloudflare/next-on-pages and deploy using wrangler with the --branch option.

I can easily create 3 different apps for each domain but would of course prefer to keep things centralized
Was this page helpful?