Canonical redirect doesn't seem to work - likely misconfiguration
I am hosting a simple webiste on workers.
I have set everything up and everything seems to work. I set custom domains and the pages work.
But I wanted to use worker to redirect from TLD to www for cannonical redirect. But that doesn't seem to work. Since there are no logs the worker might not be triggering at all? No idea I am super confused at this point and need help.
This is my toml:
This is the worker:
2 Replies
What about adding a redirect rule on your domain? That should solve your needs without needing a worker. https://developers.cloudflare.com/rules/url-forwarding/
Cloudflare Docs
Redirects
URL forwarding, also known as URL redirection, navigates the user from a source URL to a target URL with a specific HTTP status code.
Originally I got confused because there was no "single redirect" available in the dashboard. Then I was under impression that somehow "bulk redirects" are not the correct option. Now I went and checked again and sure enough, I got to configure the redirect rule as a bulk redirect and it works fine now. Thanks.