Skip to content
Go back

How to Connect a Netlify sites to a Custom Domain or subdomain Using Cloudflare with SSL Certificate

Published:

To connect your Netlify any site to your custom domain or subdomain https://blogs.janakkumarshrestha0.com.np using Cloudflare, follow this step-by-step guide:


βœ… Step-by-Step: Connect Custom Domain via Cloudflare

πŸ“Œ Prerequisites:


πŸ”§ STEP 1: Add Domain to Netlify

  1. Go to your site on Netlify
  2. Navigate to: Site settings β†’ Domain Management β†’ Add a domain
  3. Click Add a domain you already own”
  4. Enter your sub domain: blogs.janakkumarshrestha0.com.np
  5. Click Verify, then Add domain

🌐 STEP 2: Point DNS from Cloudflare to Netlify

  1. Go to your domain in Cloudflare Dashboard

  2. Go to the DNS tab

  3. Add a new CNAME record:

    TypeNameTargetTTLProxy
    CNAMEblogyour-site.netlify.appAutoβœ… ON
    • Replace your-site.netlify.app with your actual Netlify subdomain (found on your Netlify dashboard).
    • Name is blog, not the full domain.

πŸ”‘ STEP 3: Verify Domain Ownership with Netlify via Cloudflare

Netlify needs to verify that you own the domain example.com.np before it allows you to add a subdomain like sub.example.com.np.

sub.example.com.np is an alias of examples.netlify.app and has its traffic proxied through Cloudflare.

To verify ownership using Cloudflare DNS, follow these steps:


Copy TXT Record from Netlify

From Netlify:


Add TXT Record in Cloudflare

  1. Go to Cloudflare Dashboard

  2. Select your domain: yourdomain.com.np

  3. Go to the DNS tab

  4. Click β€œAdd record”

  5. Choose:

    • Type: TXT
    • Name (Host): netlify-challenge
    • Content (Value): your-value
    • TTL: Auto
  6. Click Save


πŸ”’ STEP 4: Ensure SSL (HTTPS) Works


πŸš€ STEP 5: Test Your Domain


βœ… Done!

Your blog is now live at your custom domain using Netlify + Cloudflare DNS.


Suggest Changes

Previous Post
Pull, Build an image using a Dockerfile and Push the image to Docker Hub.
Next Post
Make your localhost app live on the internet using ngrok.