Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save notTag/a770186576c064359dcb3e4e18e35bd6 to your computer and use it in GitHub Desktop.

Select an option

Save notTag/a770186576c064359dcb3e4e18e35bd6 to your computer and use it in GitHub Desktop.
Process for setting up Cloudflare with namecheap domain.
#---------------Cloudflare Pages + Namecheap Domain + SSL Cheat Sheet------------#
NOTE: You do NOT need to buy PositiveSSL from Namecheap.
Cloudflare provides free SSL automatically (Universal SSL).
NOTE: This method moves ALL DNS control to Cloudflare by changing nameservers.
After this, manage every DNS record in Cloudflare, NOT in Namecheap's Advanced DNS.
The repo can stay PRIVATE (Cloudflare Pages builds it either way).
# Cloudflare Account Setup
Add Site
Login to dash.cloudflare.com → Add a site → enter yourdomain.com
Pick the Free plan
Review DNS Records (Cloudflare auto-scans Namecheap)
DELETE the registrar parking records:
A @ 192.64.119.197 (Namecheap parking IP)
CNAME www parkingpage.* (Namecheap parking page)
KEEP the email records so mail forwarding survives:
all MX records (eforward*.registrar-servers.com)
the TXT record (SPF)
Do NOT hand-add the web A/CNAME records here.
The Pages custom-domain binding creates them for you later.
Get Your Nameservers
Click Continue past the DNS review.
The next screen shows TWO assigned nameservers, e.g.:
davina.ns.cloudflare.com
kirk.ns.cloudflare.com
(names are random per account; find them again at dashboard → domain → Overview)
# Namecheap Nameserver Change
GOTCHA: Do NOT use "Personal DNS Server" (that registers your OWN nameservers
and demands an IP address). Wrong section.
Point Nameservers at Cloudflare
Login to Namecheap → Domain List → click Manage next to yourdomain.com
Stay on the Domain tab → scroll to the NAMESERVERS section
Change dropdown from "Namecheap BasicDNS" to "Custom DNS"
Paste the two Cloudflare nameservers, one per field (hostnames only, NO IPs):
davina.ns.cloudflare.com
kirk.ns.cloudflare.com
Click the green checkmark to save
Wait for Activation
Propagation takes minutes to a few hours (up to 24h worst case).
Cloudflare emails you when the zone goes active.
# Cloudflare Pages Deploy
Option A - Git integration (auto-deploy on push)
Push repo to GitHub (private is fine)
Cloudflare dash → Workers & Pages → Create → Pages → Connect to Git
Pick the repo, authorize the Cloudflare GitHub app
Build command: bun run build
Build output directory: dist
(Bun auto-detected from bun.lock)
Save & Deploy; pushes to main now redeploy automatically
Option B - Wrangler direct upload (no GitHub needed, source stays local)
bun run build
bunx wrangler pages deploy dist --project-name your-project
First run opens a browser to authorize; later deploys are just those two lines.
# SPA Fallback (only for client-side routers, e.g. vue-router history mode)
Add public/_redirects containing one line:
/* /index.html 200
Vite copies public/ into dist/, so it ships as dist/_redirects.
Without it, deep links (e.g. /docs) hard-404 on refresh.
# Custom Domain (do after the zone is active)
Pages project → Custom domains → Set up a domain
Add yourdomain.com
Add www.yourdomain.com
Cloudflare auto-creates the proxied DNS records pointing at the Pages project.
Do NOT hand-add apex/www records; the binding owns them.
# Enable HTTPS
Automatic. Cloudflare provisions Universal SSL once the zone is active.
No checkbox to flip and no cert to buy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment