dnsnameserverscloudflare

How to test CloudFlare without changing your domain's name server


How can you test CloudFlare without changing your domain's name server?

I would not want to change my domain's name server and wait hours for propagation only to find out there is a issue with the DNS settings.

Can you spoof a nameserver or something on a local hosts file?


Solution

  • Yes, you should be able to test before you change your name servers. Here's what to do:

    1. Signup at https://www.cloudflare.com/sign-up and complete the signup through Step 4 when you're asked to update your name servers.
    2. Note the two name servers you are provided which will be in the format [name].ns.cloudflare.com.
    3. From a terminal, do a lookup to get the IP addresses your domain has been assigned. In Linux/Unix it'd be: dig @[name].ns.cloudflare.com yourdomain.example
    4. Repeat step 3 with all the subdomains you want to check.
    5. Update your localhost record to resolve the domain(s) to the IPs you found with the lookup.
    6. Browse the site from the same machine where you did the localhost update and traffic should pass through CloudFlare.

    While this will work for a while, after 24 hours CloudFlare's system may detect that your name servers haven't updated and, in some cases, may return an error. However, this technique should allow you basic testing before you update your name servers.