Staging Domain
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.
This will allow you to have a custom domain that will always show the latest build for a specific branch on your Pages project.
Currently, this setup is only supported when using Cloudflare DNS. If you attempt to follow this guide using an external DNS provider, your custom alias will be sent to the production branch of your Pages project.
First, make sure that you have a successful deployment on the branch you would like to set up a custom domain for.
Next, add a custom domain under your Pages project for your desired custom domain, for example, staging.example.com.
To do this:
- Log in to the Cloudflare dashboard.
- In Account Home, go to Workers & Pages.
- Select your Pages project.
- Select Custom domains > Setup a custom domain.
- Input the domain you would like to use, such as
staging.example.com - Select Continue > Activate domain
- After selecting your custom domain, you will be asked to activate it.
- After activating your custom domain, go to DNS for the
example.comzone and find theCNAMErecord with the namestagingand change the target to include your branch alias. - Deactivate caching.
If the origin application is protected by access policies via zero trust. Add a separate application for the new domain. But is seems that the application policy for the origin
*.example.pages.devaddress ist reflected. - Save the changes.
Pages is currently used only for this site aixlabDocs