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
}
{
"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?
4 Replies
jordanthornquest
jordanthornquestOP7mo ago
Would static redirects be preferable over Redirect Rules?
jordanthornquest
jordanthornquestOP7mo ago
For the domain problem: I bought the domain on Namecheap and pointed the DNS from Namecheap to Cloudflare via the Cloudflare Nameservers.
No description
jordanthornquest
jordanthornquestOP7mo ago
After doing so and setting up my Cloudflare Worker, I still see these "Recommended steps to complete zone setup".
No description
jordanthornquest
jordanthornquestOP7mo ago
Also, thank you for your help!

Did you find this page helpful?