Cloudflare worker routes does not work

Hi guys,

I am trying to add a worker to my websites (with Cloudflare DNS). However, nothing happens when I add the route.
The worker’s job is the default worker.js that returns the “Hello, world!” text. The worker can be accessed via the worker URL: backtick example``. But not my custom route. Here are some settings:

The strange thing is the route only works if I add the www. prefix to my website when I enter it in the search bar.
I tried to delete my website from Cloudflare and add it again so the DNS can be reloaded, but it always accesses my host’s default page instead of routing to the worker.

Can someone have a look? It took me 2 days, but I don’t know what I am missing.
Thank you.

That’s because www is proxied, it works on the FTP subdomain for the same reason as well (FTP itself also won’t work proxied but that’s a different issue). The record needs to be proxied, so traffic flows through Cloudflare, for the route to act on it. If your goal is to have the worker run on your apex proxy that DNS Record as well as any other subdomains you want it to run on.

1 Like

Oh!! You saved my day. It works now. Thank you so much!

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