Hi, I’m very new to server-less and learning about workers. I am getting the hang of scripting on my workers.dev subdomain in the and everything runs fine on it using the web editor… but now I want to use my personal domain using Cloudflare. What are the dns records I need to setup for it work? Do I need to setup specific dns records for each route? Can workers be used on a root domain? Using the workers editor for my personal domain just produces blank results/server not found. Sorry I know these are very basic questions… but couldn’t figure it out in the docs.
Go to Cloudflare Dashboard -> Choose your domain -> Choose Workers tab -> Click Launch Editor. Then click on the “Routes” tab. Enter the domain you want to apply a script to + it’s route.
That’s how I assumed it would work, but I always get “This site can’t be reached & server IP address could not be found” errors when trying urls in the browser outside the editor. My routes are very basic and work when using workers.dev domain so I assumed it was something missing on my dns records for my personal domain.
Also, in the DNS panel since I have no records it says ‘An A, AAAA or CNAME record was not found pointing to the root domain. The domain will not resolve.’ so that’s another reason why it made me think that there’s something missing with my records…
You need to have a DNS record for the routes you add in the Workers tab, they won’t be automatically added. Two options until they fix it more systematically, which they are doing:
A single A record pointing to a random IP. I recommend 192.0.2.1 which is a test network not used by anyone. A local IP could work as well, but not really recommended.
A CNAME to a random subdomain on your domain, which doesn’t need to exist.
Make sure that this subdomains need to be for Workers to run.
Here I am facing a same problem in connecting my sub domain to workers. My worker script is working find without domians name but with domians name it’s showing error.
Is there any video tutorial available how to connect subdomian or a url to workers.