Conceptual
5 min read

Accessing Deployments through Generated URLs

Whenever a new deployment is created, Vercel will automatically generate a unique URL which you can use to access that particular deployment.
Table of Contents

When you create a new deployment in either a preview or production environment, Vercel will automatically generate a unique URL in order for you to access the deployment. This URL is publicly accessible by default, but you can configure it to be private using deployment protection. The URL is structured as so:

url-structure
<project-name>-<unique-hash>-<scope-slug>.vercel.app

You can use this URL to access a particular deployment forever. It will never cease to exist and can therefore be used as part of a revision history.

You can access these automatically generated URLs in the following ways:

  • On the command line when the build has completed.
  • When using Git, you have two options to access deployment URLs. Firstly, you can access the generated URL for a specific deployment within your pull request. Alternatively, you can view a URL that displays the latest build. This URL is returned by the Vercel bot as part of a Git comment inside the Git commit, but only if the deployment is successful.
  • Under the Project's Overview and Deployments tabs as shown below
Generated URL for a production deployment.
Generated URL for a production deployment.

Generated URLs are comprised of several different pieces of data associated with the underlying deployment.

Varying combinations of the following information may be used to generate a URL:

  • <project-name>: The name of the Project that contains the deployment
  • <unique-hash>: 9 randomly generated numbers and letters
  • <scope-slug>: The slug (not the name) of the Personal Account or Team that contains the Project/Deployment
  • <branch-name>: The name of the Git branch for which the deployment was created
  • <author-name>: The username of the Personal Account belonging to the Team Member that created the deployment

To access the latest successful version of a deployment connected to a Git branch, you do not have to find the unique generated URL mentioned above. You can refresh the generated URL associated with the Git branch.

The structure of the URL will be as follows:

url-structure
<project-name>-git-<branch-name>-<scope-slug>.vercel.app

To access the URL for a successful deployment from Vercel CLI, you can save the standard output of the deploy command. The generated URL will have the following structure:

url-structure
<project-name>-<scope-slug>.vercel.app;

Once you deploy to the production environment, the above URL will point to the production deployment.

If the deployment is created on a Team, you can also use the URL specific to the deployment's author. It will have the following structure:

url-structure
<project-name>-<author-name>-<scope-slug>.vercel.app;

This allows you to easily stay on top of the latest change deployed by a particular Member of a Team within a specific Project.

If more than 63 characters are present before the .vercel.app suffix (or the respective Preview Deployment Suffix) for a generated URL, they will be truncated.

For example, this is what an Automatic Branch URL could look like:

automatic-branch-url
my-project-git-this-is-really-an-extremely-long-bra-abc123xyz-scope-slug.vercel.app;

The truncation happens by taking away from the end of this list of characters until only 56 of them remain.

Afterward, the first 6-characters of an SHA-256 hash prefix, the Git branch, and the Project name preceded by a dash (like -ar63fm) will be appended at the end to avoid collision with other generated URLs that may also be truncated.

The hash prefix will either be git-, or git-fork- if the deployment was created through a fork. In the end, the hash creation might look like this:

hash-creation
const prefix = isFork ? 'git-fork-' : 'git-';
sha256(prefix + branch + projectName).slice(0, 6);

Once the truncation is complete, the list of characters will be exactly 63 and therefore comply with the limit.

If your <project-name> resembles a regular web domain, it may be shortened to avoid that resemblance. For example, www-company-com would be changed to just company. This is done to prevent an accidental trigger of anti-phishing protection built into web browsers that protect the user from visiting domains that look roughly like other domains they visit.

Lastly, suppose a Preview Deployment Suffix is configured, and the entire generated URL exceeds 253 characters. In that case, the same truncation as mentioned above applies. Still, instead of 63 characters, the length limit will be 253 minus the length of the Preview Deployment Suffix plus 1 (for the period that precedes the Preview Deployment Suffix).

For example, if the domain acme-previews.com is configured as the Preview Deployment Suffix. In that case, that domain has a length of 17, including the preceding ., the character limit that would apply before the suffix is 18.

Preview Deployment Suffix is available on Pro and Enterprise plans

Preview Deployment Suffixes allow you to customize the URL of a preview deployment by replacing the default vercel.app suffix with a custom domain of your choice.

The entered custom domain must be:

  • Available and active within the team that enabled the Preview Deployment Suffix
  • Using Vercel's Nameservers

To enable Preview Deployment Suffix, and customize the appearance of any of your generated URLs:

  1. From your dashboard, select the Settings tab
  2. Select the Billing tab
  3. Under Add-Ons, set the toggle for Preview Deployment Suffix to Enabled
  4. Navigate to the Settings tab on the team dashboard
  5. Select the General tab and scroll down to the Preview Deployment Suffix section
  6. Enter the custom domain of your choice in the input, and push Save
Selecting a custom value for the Preview Deployment Suffix.
Selecting a custom value for the Preview Deployment Suffix.

If you are not able to use Vercel's Nameservers, see our guide on how to use a custom domain without Vercel's Nameservers.

See the plans add-ons documentation for information on pricing.

To disable Preview Deployment Suffix:

  1. From your dashboard, select the Settings tab
  2. Select the Billing tab
  3. Under Add-Ons, set the toggle for Preview Deployment Suffix to Disabled

The next preview deployment generated will revert back to the default vercel.app suffix.

You may encounter this error if you are using the Preview Deployment Suffix in your team. Make sure that the custom domain you configured is:

The best way to satisfy all of these constraints is to ensure the domain is also added to a project located in the same team. In this project, you can include a single index.html that displays when someone visits the root of the domain.

Last updated on May 29, 2024