Custom domain for workers?

I’ve set up my worker successfully on the domain, but I’d like to move the production instance to my custom domain. I’m having trouble finding more information on how to go about that.

  • I’ve added the domain to Cloudflare successfully.
  • I’d like to route a specific subdomain entirely to the worker.
  • I set up the route in both the dashboard, and in the worker wrangler.toml.
  • It says it’s published successfully to the route.
  • However, any requests to the route return a “Could not resolve host.”.

Do I need to set up a DNS entry for my subdomain route? And if so, where should I point it to?

Yes, you’ll need a DNS record - see A record name for worker


Is there a step by step set of instructions for this? I see this in the doc:

Note: if your route is configured to a hostname, you will need to add a DNS record to Cloudflare to ensure that the hostname can be resolved externally. If your Worker acts as your origin (the response comes directly from a Worker), you may enter a placeholder (dummy) record, pointing to an IP such as, since the Worker will respond before ever connecting to that origin.

But I’m not exactly sure what should go where. Do add something for the worker? Or for my domain? What should the entries look like?



  1. Add your domain to CF and select the free plan.

  2. Go to your domain management panel where you bought your domain (Namecheap, GoDaddy, etc) and point the domain to the CF nameservers. You will find those in the CF dashboard.

  3. Open the domain in the CF dashboard. Click on the DNS tab at the top and remove all DNS records (except maybe MX records if you have a mail server for that domain).

  1. Now your domain is ready to receive requests in the CF network, but since it has no A or CNAME records the worker routes will not work. To solve this you need to create 2 “fake” A records pointing to so that the worker routes can be “matched” to your domain. One record with the name @ and the other with the name www.

The @ means and www means

  1. Create your worker with the route(s) you want. Eg:*.

Before any of this actually works you will need to wait until the nameserver changes have propagated. You can check the progress here (change to your domain):

1 Like