Deploy Previews
Deploy Previews allow you and your team to experience changes to any part of your site without having to publish them to production.
# Get started
By default, Netlify automatically builds Deploy Previews when you open pull / merge requests in a connected site repository from GitHub, GitLab, Bitbucket, or Azure DevOps.
The base branch must either be a production branch, or a branch that has branch deploys enabled.
Once the deploy is complete, you can access the Deploy Preview at the unique Deploy Preview URL. By default, Deploy Previews are active for 90 days. The Deploy Preview remains available until the deploy is deleted either automatically or manually.
To change these settings or to control who can access your previews, review the section below on how to configure Deploy Previews.
# Status and notifications
As Netlify starts to generate your Deploy Preview, a Deploy Preview status will appear on your pull / merge request. The status automatically updates to reflect the deploy progression. Once the status is marked as complete, you can access your Deploy Preview at the unique Deploy Preview URL.
If you have deploy notifications enabled, Netlify will also add a comment to your pull / merge request with a link to the Deploy Preview once it is ready.
# Configure Deploy Previews
In the Netlify UI, you can choose to disable Deploy Previews for all new pull / merge requests.
To disable or enable Deploy Previews for all new pull / merge requests:
Go to
, and select Configure.Choose whether to disable or re-enable Deploy Previews.
To confirm, select Save.
If you can’t find this setting, ensure you have enabled continuous deployment for your site by linking to a Git repository.
# Customize landing page for Deploy Preview
To customize the first page that visitors land on when they access your Deploy Preview, you can set the entry path for a Deploy Preview in the Netlify Drawer or in your pull/merge request.
# Set entry path in Netlify Drawer
To automatically update the Deploy Preview link in the Netlify UI, set the entry path in the Netlify Drawer. This updates the link in the Deploy page or deploy details page.
To set the entry path:
Open the Netlify Drawer on a Deploy Preview and sign in if you haven’t already.
Go to Deploy settings.
Set your entry path and Save.
# Set entry path in pull/merge request
To automatically update the Deploy Preview link in your pull/merge request comment, set the entry path in your merge/pull request opening description.
To set the entry path:
In your pull/merge request, add
@netlify
followed by the relative path to your page.For example:
@netlify /get-started/
Push a new commit or empty commit to generate the new Deploy Preview link.
To standardize this across many PRs in your site’s repo, you can add this syntax to your PR template:
<!--Set an entry path if your PR has a primary page for review.
Add a relative path next to `@netlify` below.-->
@netlify /
Note that you can’t customize the Deploy Preview entry path in the Netlify Drawer once you customize it in the pull/merge request.
# Protect all Deploy Previews with a password
You can control who can access your site’s Deploy Previews by requiring a password to visit your Deploy Preview. Review our Site Protection docs to learn more.
# Set environment variable values for Deploy Previews
You can set different environment variable values for each deploy context, including Deploy Previews. This can be helpful if you want to set a different CMS environment to use for production versus Deploy Previews, for example.
To set specific values for the Deploy Previews
context, create your environment variables with the Netlify UI, CLI, API, or a Netlify Configuration file.
# Deploy Preview URLs
Deploy Previews work by deploying pull / merge requests to a unique URL different from the one your production site uses. This URL has the prefix deploy-preview
followed by the identifier number of the pull request or merge request. For example, a Deploy Preview for pull / merge request #42 will deploy to deploy-preview-42--yoursitename.netlify.app
.
While the initial deploy for your pull / merge request is pending, this URL will result in a Not Found
error. For subsequent changes, the web content of the Deploy Preview URL will update as changes are pushed to the pull / merge request and successfully deployed.
You can share this URL with your team to collaborate and gather feedback.
Every deploy also has a permalink that starts with the deploy ID number. For example: 1234abcd12acde000111cdef--yoursitename.netlify.app
. The contents of this URL never change, even after you redeploy your site.
Set up automatic deploy subdomains to ensure deploys are accessible
If you use Netlify DNS to manage a custom domain for your site, we recommend that you consider setting an automatic deploy subdomain for your Deploy Previews. This ensures that the deploys are not blocked by any third-party scripts or services that require this, such as local internet service providers.
# Collaborate on Deploy Previews
Using the Netlify Drawer on your Deploy Previews, you and your team can add, review, and manage feedback about site changes right from your site. You can leave comments, take screenshots and video, and test responsiveness on a mobile device.
You can open the Netlify Drawer with the keyboard shortcut ⌘\
on Apple or ^\
on Windows/Linux.
Learn more about using the Netlify Drawer in our docs on collaborating on deploys.
For troubleshooting guidance, check out our troubleshooting docs for using the Netlify Drawer.
Did you find this doc useful?
Your feedback helps us improve our docs.