Cloudflare Pages and CNAME Flattening

I am trying to setup a static site in cloudflare pages, the project was completed and the dev url (https://xxx.pages.dev) 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.

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

@sdayman

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 192.0.2.1 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 www.domian.com/anything


and www CNAME is pointed to domain.pages.dev
image

This post was flagged by the community and is temporarily hidden.

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 pages.dev domain in your browser url in the end.

No there is no pages.dev 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 *.pages.dev domain directly because of redirect cache.

No, I am redirecting domain.com to www.domian.com