Cloudflare DNS settings for Cloudflare Pages

Hi all,
this is more of a sanity check as to if I’ve setup my Cloudflare DNS correctly for my Cloudflare Pages website.

I have my domain registered with Cloudflare, the apex domain and www both point to my pages[.]dev url like so:

  • domain[.]com → project[.]pages[.]dev
  • www → project[.]pages[.]dev

The only other DNS records are for MX and TXT (email setup). There is no A record as there is no IP that I can find for the Cloudflare Pages project. The above appears to work. I also have redirects in place for both:

  • domain[.]com → www[.]domain[.]com (naked to www domain)
  • project[.]pages[.]dev → https://www[.]domain[.]com - Preserve query string, Include subdomains, Subpath matching, Preserve path suffix, all checked (this is to prevent browsing my site on the project[.]pages[.]dev URL)

Does this look right for having my website hosted on Cloudflare Pages with a Cloudflare domain? Basically I just want the site to only be accessible via https[:]//www[.]domain[.]com

Thanks for any insights

A CNAME is a canonical redirect, basically saying “look over here for results!”. They work a bit more specially with Proxy Enabled, but essentially the same idea, it’s resolving the project.pages.dev for an A/AAAA record to get an IP to send the request to, essentially.

Sounds sane to me. Only thing I would mention is your project.pages.dev bulk redirect, if you want to use the preview deployment urls/branch previews, you’d want to uncheck Include subdomains and under the Pages Project → Manage tab → Access policy, you can enable Cloudflare Access on your previews so they are still accessible but protected. If you don’t care about the deployment previews then you’re all set.

3 Likes

Brilliant, thank you @Chaika ! That answered all my questions, and how cool is Cloudflare Access, that was super easy to setup and seems to work exactly as advertised, what a great solution.

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