Need help with the www subdomain

I am failing to get the www subdomain to work with my websites. I thought all I had to do was add www as a CNAME entry but that does not work. I see that maybe I need to add an A entry (the help text at the top is misleading if this is the case) but I don’t know where to find the IP address of my “origin server.”

What is your domain, and what CNAME entry do you currently have configured?

I have 2 different domains. The CNAME entry set up on both DNS records are:

Type: CNAME
Name: www
Target: @
TTL: Auto
With proxy on.

This does get rid of the recommended steps text at the top of the screen. I’m a little confused on why name is www while target is @. I would think it should be reversed. But when I try to put name as @ and target as www.@, I get this error:
An A, AAAA, or CNAME record with that host already exists. (Code: 81053)

You should delete those records.

Then, follow your hosting platform’s guide on how to add a custom domain. As part of that guide, you will receive the DNS records that you need to add to Cloudflare.

Just to help anyone that might be in the same situation I was, I’ll put a more complete answer for the solution. But @Laudian was correct.

First off, I should have made it apparent that I’m using Cloudflare Pages. If you are using Pages, you can go to the project and there is a custom domains tab that you can add your custom domain(s) to. For me, I’ve added two custom domains, one without the www subdomain and one with the www subdomain. I’m not sure if this does anything more than add a DNS record to your domains DNS table.

That being said, the custom domain with the www subdomain added a CNAME record where the name is www and the target is the Pages link (something like projectname.pages.dev).

2 Likes

Yes, it does more than create the DNS records. It also takes care of the server-side configuration.

1 Like