Cloudflare Tunnels step-by-step setup - adding your domain to Cloudflare

8 min read
  1. Login to your Cloudflare account at https://dash.cloudflare.com/login
  2. Click on the domain name you wish to add the tunnel to.
  3. Click on the "Cloudflare Workers" tab at the top of the screen.
  4. Click on the "Create a Worker" button.
  5. Give your worker a name, for example "tunnel.yourdomain.com".
  6. Paste the following code into the code editor:
const tunnel = new Tunnel()
addEventListener('fetch', event => {
  event.respondWith(tunnel.handleRequest(event.request))
})
  1. Save the worker.
  2. Click on the "Tunnels" tab at the top of the screen.
  3. Click on the "Get started" button.
  4. Click on the "Add a domain" button.
  5. Enter the domain name you want to use with the tunnel, for example "tunnel.yourdomain.com".
  6. Click on the "Create demo certificate" button.
  7. Wait for the certificate to be created.
  8. Click on the "Install" button next to your domain name.
  9. Add a CNAME record to your DNS configuration pointing to the provided domain name.
  10. Wait for the DNS record to propagate.
  11. Click on the "Verify" button to check if your domain is configured correctly.
  12. Your domain is now ready to use with Cloudflare Tunnels!