Skip to content

Instantly share code, notes, and snippets.

@nikkaroraa
Last active September 18, 2020 07:35
Show Gist options
  • Save nikkaroraa/d4746b78d789f1c6621b9766fba4a4ef to your computer and use it in GitHub Desktop.
Save nikkaroraa/d4746b78d789f1c6621b9766fba4a4ef to your computer and use it in GitHub Desktop.
How to setup Vercel with Cloudflare?

Setting up Vercel with Cloudflare

  • Go to "Domains" section in Vercel
  • Type out your domain, and click on "Add"
  • It'll give you an "A" record to enter in the DNS settings
  • Navigate to the Cloudflare dashboard
    • From there go to DNS, and add the A record there with Proxy status being set to "true"
    • I also had an "A" record which was pointing to Namecheap, since I bought the domain from there. Make sure to remove that.
      • "A" record is basically an Address record that maps the domain name to the IP address of the computer hosting the domain
    • Add a CNAME record to handle "www"
      • Set "Name" to "www"
      • Set "Content" to "domain.com"
      • Set Proxy Status to true
    • Now go to SSL/TLS settings
      • Set encryption mode to "Full(strict)"
      • Go to edge certificates, and turn off "Always use HTTPS"
    • Now go to "Page rules"
      • And add *domain.com/.well-known/* and choose SSL for that setting and turn it "off"
      • This is required by Vercel to generate certificates
  • Finally go to vercel and make sure you add both the versions of the domain
    • domain.com
    • www.domain.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment