How do I configure an Apex Domain for Cloudflare Workers & Static Assets?

I've worked through the following setup guides to configure an Astro site on Cloudflare Workers & Static Assets:

- Framework guide for Astro
- Custom Domains for Workers

I have a domain that is managed by Cloudflare. I've configured my project's wrangler.jsonc with the following:

{
  "assets": {
    "directory": "./dist"
  },
  "compatibility_date": "2025-05-04",
  "name": "mysite",
  "routes": [
    {
      "custom_domain": true,
      "pattern": "mysite.com"
    },
    {
      "custom_domain": true,
      "pattern": "www.mysite.com"
    }
  ],
  "preview_urls": true,
  "workers_dev": false
}


My questions are:

- On my domain's "DNS Records" page, I am shown an "Add an A, AAAA, or CNAME for your root domain so mysite.com will resolve" message. Is this message not relevant to my Cloudflare Workers setup, or am I missing a configuration step?
- What is the best practice for configuring a www redirect, so requests to www.mysite.com instead go to mysite.com?
Was this page helpful?