DNS setup: Error code 522 with 'www'

Hi. Cloudflare is registrar for my domain (nocodeportal.com) and my website is hosted on Cloudflare Pages.

It’s is working fine for nocodeportal.com and the Pages dashboard also gives the ‘Active’ status. I added custom domain via the pages dashboard

However, it fails to work for www.nocodeportal.com and I get error 522 (connection time out). Is there anything wrong with my settings?

You need to add www (www.nocodeportal.com) seperately under Pages Custom Domains tab, just like you did for your apex (nocodeportal.com). It’ll ask to replace the current DNS Record and that’s fine.
You can think of Pages Custom Domains as having an allowlist of host headers/hostnames which are allowed, and as www isn’t configured it just fails to connect.

It is usually recommended for SEO purposes/not confusing your visitors to just do a redirect instead from www to your root/apex. There’s a guide here from Pages for that: Redirecting www to domain apex · Cloudflare Pages docs

Right. Thanks so much!

1 Like

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