Cloudflare Pages and CNAME Flattening

I am trying to setup a static site in cloudflare pages, the project was completed and the dev url ( is working as expected.

I want to host this site under my domain name, so I added custom domains (DNS is managed in cloudflare itself.) CNAME record was created automatically and status is “Active”

Now the problem is the site is not working with the custom domain name. I noticed the new CNAME record was flattened because CNAMES are not allowed at zone apex level.

When i browse the site using custom domian i get below error page “Error 523”

DNS records were create 8 hours ago, so i hope its not a propagation delay, What could be wrong? Kindly help.

1 Like

I have a handful of Pages sites deployed to apex domains. I created a page rule to redirect ‘www’ to apex.


How did you manage to add AAAA www → :: (proxied) record

Mine returns:

“DNS Validation Error (Code: 1004) This record type cannot be proxied.”

Is it necessary to have this record for a custom domain?

For whatever reason, dashboard no longer accepts that as a valid entry. I’m back to using an “A” record of instead. I use it so I can create a Page Rule (Forwarding URL) for that hostname.

Could you please share your dns settings;

My custom domain is on CloudFlare too.

adding CNAME record from custom domain to pages doesn’t work for me

Error 522

Ray ID: 6727a188da240d42 • 2021-07-21 21:48:01 UTC

Connection timed out

Hello, @nelsonkthomas!

Did you manage to solve your problem?

Yes, I managed to solve the issue by creating a rule. The rule will redirect all requests to

and www CNAME is pointed to

I don’t get it, why is it necessary to have permanent redirect (forwarding rule you mentioned) together with CNAME record?

Not sure, it just works!

But it adds additional latency for the browser to redirect.

CNAME approach shouldn’t have this flaw.

Also there will be domain in your browser url in the end.

No there is no at the end

It has to be, Cloudflare sends 301 permanent redirect to the browser for the first time according to the forwarding rule.

All subsequent requests will go * domain directly because of redirect cache.

No, I am redirecting to

I did this exact same setup
-cname www to
-rule to redirect base domain to www

and I get an error 522 connection timed out error. Any idea why that might be happening?