Trying to call worker from custom domain

I have connected a custom domain name to my Cloudflare Worker, but sending requests to that custom domain isn’t calling the worker as I would be expecting.

On the same page that talks about custom domains for workers, there is info about adding stuff to wrangler.toml, so I’m trying to do that, but keep getting errors when going to deploy. The latest error that I received is workers.api.error.origin_hostname_mismatch_zone.

The following is my wrangler.toml file:

name = "qrproxy"
main = "src/index.js"
compatibility_date = "2023-12-18"

kv_namespaces = [
  { binding = "qrproxy", id = "<kv ID>" }
]

routes = [
	{ pattern = "qrpro.xyz", zone_id = "<the zone ID>", custom_domain = true }
]

When I used the Cloudflare Accounts UI to add a custom domain to my worker, a DNS entry was created:

Am I right to expect that I could send requests to my custom domain as if it’s the workers URL? If so, how am I supposed to get it to work?

Is your domain qrpro.xyz? The screenshot shows grpro.xyz (g not q)
You’ll need to match the name of your domain in the pattern. Also, make sure your zone ID is the same as the one listed under your domain (zone)

https://grpro.xyz/ does seem to be firing a Worker
qrpro.xyz is not a registered domain

2 Likes

OH MY GOODNESS. What an absolute rookie mistake… I purchased a domain with a typo :man_facepalming: :man_facepalming:

Thanks for providing some fresh eyes, I guess I’ll go an purchase the domain that I actually wanted

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.