How can I migrate a site to Vercel without downtime?

With this article, we plan to guide you through all the steps necessary on how to migrate a domain to Vercel without downtime. Your domain should be serving content from 3rd party servers that are unrelated to Vercel, and you need to be prepared to make the necessary DNS changes.

Generating a Certificate

While Vercel will serve your domain with HTTP until a certificate is ready, it is a good experience for your users to use HTTPS. Therefore, to ensure the certificate exists beforehand, you can generate it manually. To do so, you can use the following commands using the Vercel CLI:

vercel certs issue "*.example.com" example.com --challenge-only
Creating the challenge for the certificate that will be used for *.example.com and example.com.

We recommend users to issue certificates for the specific domains they want to migrate. If the DNS configuration of example.com is pointing to non-Vercel servers, and you plan to migrate both www.example.com and example.com to Vercel deployments, you can create a challenge with the following command:

vercel certs issue www.example.com example.com --challenge-only
A DNS challenge for the certificate that will be used for www.example.com and example.com.

After running the command above, make sure you insert the necessary TXT records in your DNS provider. You can also check if the records are correct with the command dig:

dig TXT _acme-challenge.example.com +short
Verifying if the name _acme-challenge does contain a TXT record.

After the challenge is in place, we can issue the certificate. You can enter the command previously used without the --challenge-only flag:

vercel certs issue www.example.com example.com
Issuing a certificate that covers both www.example.com and example.com.

Verifying the Certificate

We learned how to generate a certificate before we assign a domain to a Vercel deployment. Before you change the DNS records of your domain, we can verify if the certificate is correct and will be accepted by browsers. You can run the following command:

curl https://example.com --resolve example.com:443:76.76.21.21 -I
curl command that sends a request directly to Vercel, ignoring the DNS configuration of the domain.

If the request is successful, we confirmed the certificate is working and you can proceed with the migration.

Changing the DNS Records

Once you have added the domain to your Vercel project and also verified the certificate is working as expected, you can choose three options of records to finally complete the migration: A, CNAME, or Nameservers. In case you decide to use an A or a CNAME record, then you can change those records in your DNS provider to make Vercel serve your deployment from the selected domain, as instructed on your dashboard.

If you decide to change the Nameservers of your domain, you can follow the below instructions which will help you migrate your DNS configuration to any provider and avoid downtime.

Clone the Current DNS Configuration

To locate the current DNS provider of your domain, you can run the following command:

dig NS example.com +short
Checking the DNS authority for a domain using the terminal.

The result will show the current DNS authority. Next, you'll need to locate your DNS records from the provider's dashboard. If you are using Vercel, the DNS configuration is located in your dashboard.

After you've successfully located all records associated with your domain, you can either download a "zone file" or copy each record manually to the new provider.

Verify the Records

To verify the records, you can query the DNS configuration served by the future DNS authority:

dig A api.example.com +short @ns1.vercel-dns.com
Checking the DNS configuration of the A record under "api" served by Vercel.

If you were moving your DNS to Cloudflare, for example, the correct command would be:

dig A api.example.com +short @example.ns.cloudflare.com
Checking the DNS configuration of the A record under "api" served by Cloudflare. The example should be replaced with the authoritative nameserver given by your provider.

Before proceeding, we recommend checking every record you moved. For more insight into the DNS resolution, remove the +short flag.

Switch the Nameservers

In your registrar's dashboard (where you bought the domain), change the Nameservers to your new provider. Nameserver changes can take up to 48 hours to propagate. If you bought the domain from Vercel you can manage nameservers from the domains page.

Couldn't find the guide you need?