Cloudflare Pages: www subdomain returns 522 error ("unknown host")
My static site on Cloudflare Pages is returning a 522 error for the www subdomain. The apex domain (domain.com) works fine. Nothing changed recently (simple HTML+CSS+JS), and it was working normally a few weeks ago.
When pinging www.domain.com, it shows "cannot resolve: unknown host". However, the apex domain resolves correctly to 172.67.145.178 (oddly not listed in Cloudflare's IP ranges). MX records are resolving correctly, and emails work perfectly.
I already tried:
- Enabling developer mode and pausing Cloudflare.
- Deleting and recreating the www CNAME record.
- Creating a completely new subdomain with a different value (this new subdomain resolves on ping but also returns 522 when opened).
Only www continues failing entirely (on ping and when opened).
Any suggestions on how to solve this issue?
2 Replies
Creating a completely new subdomain with a different value (this new subdomain resolves on ping but also returns 522 when opened).You need to add each subdomain/hostname as a new Pages Custom Domain under your Pages Project -> Custom Domain, or it'll 522. Are you doing so? That wouldn't fully explain the issues with www, but I'd start there and ensure it's added if you want it to work just the same as your apex
Ah, yes, it worked. What is really weird is that a few weeks ago the www was working fine, even without this Custom (sub) Domain.
Thank you!