Join the Webstudio community

Updated 2 months ago

www redirect : how does it work ?

At a glance

The community member is having trouble with the documentation for setting up a Cloudflare redirect from www to the root domain. They don't understand why the documentation doesn't mention the need to create a CNAME record for this redirection to work. Another community member responds that a CNAME is not necessary, but rather a dummy DNS record pointing to Cloudflare's reserved IP address should be used instead. The community members discuss the best configuration for this setup, and one of them updates the documentation to address this issue. The final recommendation is to add a www record pointing to the Cloudflare IP address, and ensure it is proxied through Cloudflare for the redirection rules to work properly.

Useful resources
I don't understand why this documentation https://docs.webstudio.is/university/foundations/publishing-and-custom-domains and this one https://developers.cloudflare.com/rules/url-forwarding/examples/redirect-www-to-root/ don't mention the need to create a CNAME redirecting www to the root domain.

Without this CNAME, I can't do the redirection, the Clouflare redirection rule doesn't work. Am I wrong? Have I missed something?
J
B
10 comments
You are somewhat correct. There needs to be a DNS record in order for Cloudflare to do anything with it. If you don't add www. then Cloudflare isn't actually seeing the request come through.

However, it does not need to be a CNAME. Actually it should be a dummy record... ie a record that points to cloudflare's reserved dummy ip just for this kind of stuff.
Ill look at updating the docs
What's the best possible configuration? I'm not technical enough to understand all the details of this subtlety, I just want the redirection to be done properly and not be penalised.
Cloudflare doc does not mention the problem either, I find it weird
just updated the doc. See if that works
should this record be proxied ? is it the @ or the www to the ip adress ?
Yes it should be

Cloudflare rules can't apply to traffic that isn't proxied through Cloudflare.

But maybe I should add it next to the IP address too.

@ vs www it depends. It would be the one you are redirecting.
If you're redirecting www then add www and point to that IP
that works perfectly thank you
Add a reply
Sign up and join the conversation on Discord