Adding additional `www` CNAME to the root doesn't work

Hello there! I am fairly new to Cloudflare. So, the other day, i have managed to deploy a react app on Cloudflare; Yayyy! However, i am having trouble configuring a new CNAME record whose value is the usual www to point to the root, which is in my case In other words, i want www to behave as the root. But, as you may have guessed, it didn’t work.

So, my initial guess was: “maybe it is caused by the CNAME flattening rule”. To test this hypostasis, I think we should allocate a dummy ip address and create an A record for with that ip. And then generate a CNAME to point to root. This will remove the use of the CNAME flattening rule from the equation. Though i didn’t try this solution, however, what i did try is to keep the CNAME flattening rule there:

The target of the first record is the url where the build is located(the edge?); there is nothing special here. Interestingly, if we apply a permanent redirect page rule to this domain, as shown in the image below(in the following reply), it will make it work.

I believe that it is not the right solution, as it will generate unnecessary traffic.

< HTTP/1.1 301 Moved Permanently
< Date: Tue, 19 Jul 2022 09:21:04 GMT
< Cache-Control: max-age=3600
< Expires: Tue, 19 Jul 2022 10:21:04 GMT
< Location:

Back to the initial solution, how can i get the ipv4 and v6 for the app deployed on the Cloudflare network? Do you think it will work if we allocate A and AAAA records for these ips? If so, how to do it, cause i need the ip’s, is it random?

Note that i cannot allocate a www CNAME record on the DNS provider i am currently using; it can only be managed on Cloudflare.

I hope you get what i am trying to accomplish — looking forward to your response.


Screenshot from 2022-07-19 11-42-24

I feel like i am doing spaghetti networking.

When you say you deployed “on Cloudflare”, do you mean Cloudflare Pages?

And you want www.* to work the same as the root, without a redirect? Then you need to add to the list of custom domains for the Pages project, so it knows to answer to that name.


yeah i want and to point to the same webpage, the deployed Cloudflare page. However, I did that; It didn’t work. I think that the main issue is because, on the free plan, users don’t have access to the cpanel:

The thing is that if you do dns lookup on the domain name, the cname record is empty:

Screenshot from 2022-07-19 21-07-47

I am a bit skeptical whether or not it will affect the SEO score of my website, and probably some domains will blacklist my domain because something is wrong with the configuration. With that noted, is it possible to configure cname records on the free plan?

This thing really boggled my mind as the cname records are already there defined under the DNS tab.

Cloudflare is turning your CNAME into A and AAAA records behind the scenes. This isn’t something you need to worry about.

And it has nothing to do with domain registration. You need to go into the Pages project, under Custom Domains, and add as a custom domain for the project. You already have configured there; just add the www version as well.

1 Like

Hmmm. Interesting! Wasn’t aware of that config. Thanks for pointing that out. Gimme a moment; BRB.

Now, i am stuck at this:

Screenshot from 2022-07-19 21-39-17

I can’t perform this action as Cloudflare already managing the dns records. Do i need to add it under the dns tab?

I can only add nameservers at the DNS provider side:

Your DNS is on Cloudflare, so the record will be added automatically. Beneath that “Log into your DNS provider” thing (which is misleading, since you don’t have to log into anything) there should be another link to verify the entry. This can take a little while, but it usually happens faster than this page claims it does. I just tried it and it worked instantly, despite that page still saying “verifying” for a couple minutes.

You still have a redirect in place, though, from www to the root domain. You should delete that since you don’t want the redirect.

1 Like

Yup! I think the UI should be updated accordingly.

Will do that, and will inform you once it works. I am forever grateful for your support!

Ayo! It is working! Less goooo! Once again, thank you for the ultimate support.

I will definitely recommend Cloudflare to every damn person I encounter throughout my entire existence! You guys are awesome! The amount of services provided out the box on the free plan is tremendous, from proxies to SSL, to DDoS protection, etc. I can’t even comprehend how it is even free. I think Elon will use Cloudflare on mars.

One last thing, when I curl the domain with the www alias, i still get 301 Moved Permanently in the response message:

➜  ~ curl -vIL
> HEAD / HTTP/1.1
> Host:
> User-Agent: curl/7.68.0
> Accept: */*
* Mark bundle as not supporting multiuse
< HTTP/1.1 301 Moved Permanently
< Date: Tue, 19 Jul 2022 19:55:26 GMT
< Cache-Control: max-age=3600
< Expires: Tue, 19 Jul 2022 20:55:26 GMT
< Location:

Just wanted to make sure whether or not it is a normal response to get in return.

You are requesting the site via HTTP (non-secure) and it is redirecting to HTTPS (secure), which is almost certainly what you want.

Try the same command but put https:// at the beginning of the URL and it will look like you expect.

1 Like

Regarding this thread, do you think there should be a piece of documentation that explains how to add cname records for the web pages? Cause i spent the whole day scouring the internet looking for tutorials on this topic, without any luck. I think it would be extremely helpful for newcomers to get started using pages. There could already exist documentation that i didn’t stumble across regarding this topic. If it is not the case, I would be happy to contribute. But first, i need a little guidance to let me kick off a contribution.


I can see how the documentation could be worded better. It makes it sound more complicated than it is by making it sound like the uncommon edge cases are something you need to deal with normally.

1 Like

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