www redirect is not working

Hi, my www redirect is not working. I want to redirect www to non www. www.entdecke.solar is not reachable. My website is hosted on cloudflare pages and I have a CNAME with www that goes to the pages URL
No description
6 Replies
Kroks
KroksOP2mo ago
https entdecke.solar works fine without www but with www it fails
fry69
fry692mo ago
Not sure about pages, but with workers I do not have to put those CNAMEs into DNS, I can just add "custom domains" in the settings tab for the worker You can also set these custom domains directly in the wrangler.toml file like this ->
routes = [
{ pattern = "example.com", custom_domain = true },
{ pattern = "www.example.com", custom_domain = true }
]
routes = [
{ pattern = "example.com", custom_domain = true },
{ pattern = "www.example.com", custom_domain = true }
]
Kroks
KroksOP2mo ago
Yeah I did put "entdecke.solar" as custom domain it doesnt allow to put www.entdecke.solar though it does not automatically redirect www to https without www thats what I want because a lot of people are searching websites with www prefix
fry69
fry692mo ago
That sounds weird, it should work.
Kroks
KroksOP2mo ago
indeed it does I just redid it, not sure where I tried doing that beforehand Cause there it told me to use the root domain But I probably was just on the wrong tab or something thanks
fry69
fry692mo ago
I'd recommend no to touch DNS directly unless you have a very specific problem you want to solve. Just let pages/worker manage those by themself, there seems a bit of Cloudflare magic going on.
Want results from more Discord servers?
Add your server