Trouble binding subdomain to workers

Hi - I have my domain set up in cloudflare and I would have thought it would be straightforward to bind a trigger to the domain. I have my routes
"routes": [
{
"pattern": "my-project.my-domain.com/",
"zone_name": "my-domain.com"
}
],
"routes": [
{
"pattern": "my-project.my-domain.com/",
"zone_name": "my-domain.com"
}
],
Set up and it appears to be working - no complaints registering that binding. However nslookup my-project.my-domain.com is failing, falling back to my ISP's default page.
Do I need to set up a subdomain in DNS? And if so to what address do I point it? It feels like I shouldn't have to do any of this since the domain is managed by cloudflare DNS, but I might be missing something.
2 Replies
Chaika
Chaika2mo ago
Routes don't add records. If you just want to use the entire hostname with your worker, use Custom Domains instead of normal routes https://developers.cloudflare.com/workers/configuration/routing/custom-domains/
routes = [
{ pattern = "my-project.my-domain.com", custom_domain = true }
],
routes = [
{ pattern = "my-project.my-domain.com", custom_domain = true }
],
If you wanted to use routes instead, like for having more then one worker on a hostname but not a real origin (they have no advantage if the use case is using an entire hostname/subdomain), the "originless" record you can make is AAAA name 100:: Proxied. 100:: is IPv6 Discard, i.e traffic will be handled by the worker, and if it gets to the connecting to origin part, it just gives up
Alex Strachan
Alex StrachanOP2mo ago
The custom_domain true looks about what I wanted let me try that; thanks!

Did you find this page helpful?