I am hosting a simple web-app on Cloudflare using pages and a basic DNS configuration for a custom domain name. For privacy sake, call it myapp. When I visit https://myapp.com the web-app works correctly, but when I visit https://www.myapp.com I am shown a 522 error.
I have subdomain set up and working correctly, admin.myapp.com, using the following DNS record:
type: CNAME, name: admin, target: myapp-admin.pages.dev
I have tried doing the same for a www subdomain to no success, using the following DNS record:
type: CNAME, name: www, target: myapp.pages.dev
My custom domain maps to my Cloudflare pages domain using this DNS record:
type: CNAME, name: myapp.com, target: myapp.pages.dev
Where might I be going wrong here?