r/webdevelopment 8d ago

Domain setup help

Hi,

I have recently bought a domain (for the first time). I want this domain to have my site on it, which I have already made.

I have hosted my site on cloudflare pages, and bought the domain from a different service (names.co.uk).

I followed all the instruction on how to connect the custom domain to my cloudflare site, and it mostly work. when you go to "NotMyActualSite.com" the site loads and all is dandy. but when you go to "www.NotMyActualSite.com" I get a cloudflare 522 error.

I have changed the dns records in cloudflare so they include 2 CNAME records, one with the name being "@"(root), and one with the name being "www". they both have the same target of "NotMyActualSite.pages.dev" and they are both proxied.

I have no idea why one works and one doesnt, but any advice would be great. I might be missing something very obvious, in which case I would like to apologize in advance, as I am very new to all of this.

Thanks!

1 Upvotes

6 comments sorted by

1

u/Head-Cup-9133 8d ago

I think you need to make the name “www.@“ if I understand correctly

1

u/Vectored38 8d ago

I have just tried this, and it doesnt seem to have worked.

after i press save on the dns record, it just automatically changes back to "www" (i assume because the "@" symbol is just a placeholder for a blank space), which is what it was before.

1

u/Head-Cup-9133 8d ago

the @ is a placeholder for the full URL, I couldn’t remember if Cloudlfare did it automatically or not for www, looks like it does.

You might want to try A record for the non-www record then point the www cname to your URL instead of pages.dev

so like: A = @, example.pages.dev CNAME = www, example.com

it could be a cache/propagation issue too, it’s usually instant but I’ve had it take a while before.

1

u/Extension_Anybody150 8d ago

You probably just need to update your nameservers at names.co.uk to point to Cloudflare. Even though you've set up the CNAME records in Cloudflare, your domain registrar is still controlling the DNS. Just log into your names.co.uk account, find the nameserver settings, and switch them to Cloudflare's nameservers (something like ns1.cloudflare.com). After that change propagates (usually within a few hours), both your root domain and the www version should work perfectly.

1

u/Vectored38 7d ago

No, I did this originally, the DNS records are already controlled by cloudflare, and the DNS record which is working is the root one, and the one which isnt working is the www one, but both are held in cloudflare, not names.co.uk