Custom domain for Cloudflare Pages do not work (522 error code)

Hi, I have a static page on GitHub linked, via Cloudflare Pages. It works – I can view via a subdomain ( Then, I added a custom domain on that Cloudflare Pages, which then added CNAME automatically. I further added CNAME for www, pointing to the main page. There are also some other DNS settings,

However, the main domain (custom domain) does not work. It keeps giving me “Error code 522
The screenshot of error:

I have followed multiple posts on this Community – tried to remove/reconnect a Custom Domain, also remove/reconnect a Github repo. I’ve also waited and tried again since yesterday. Overall, it gives me the exact same problem. works but the main custom domain does not work.

Another detail may be that my site (as a static repo hosted on github) was served via Netlify. And yesterday, I moved it to Cloudflare. It worked fine on Netlify (and I wrongly thought that the transition would be easy).

I appreciate your help!

You have added the apex domain but not the www. Add the www as well to the Custom Domain section and it’ll work (like the apex does right now).

Ok thanks and it works

Just fyi, previously and still, I have another website (same configuration, github, pages, custom domain). And I didn’t have to add www to the Custom Domain section. Simply CNAME (www) was enough.

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