Subdomain don't work with Cloudflare pages. HELP
Hi I'm currently building a tool with cloudflare pages, and have a middleware which checks the subdomain and show return a value.
I was able to test this using the test.mysite.pages.dev
but when I connected my domain, and added a wildcard routing, it didn't work.
Also added just a normal domain and still didnnt work.
my DNS
AAAA
*
100::
Proxied
CNAME
mysite.com
mysite.pages.dev
Please help, i've cleared the cache, and reconnected my domain, but the subdomain still don't seem to work.
6 Replies
You need to add it as a custom domain to your Pages Project
https://developers.cloudflare.com/pages/configuration/custom-domains/#add-a-custom-cname-record
Cloudflare Docs
Custom domains · Cloudflare Pages docs
When deploying your Pages project, you may wish to point custom domains (or subdomains) to your site.
Still getting the same issue
I remove the default mysite.com
and change it to sub.mysite.com and still get the same issue.
What I want to achieve though is the ability for mysite.com to still work, with any subdomain whildcard, but even the default subdomain don't work
Wildcard subdomain isn't possible. Each domain needs to be listed here: https://dash.cloudflare.com/?to=/:account/pages/view/:pages-project/domains
oh that works, is there no way to make a wildcard subdomain with pages.
I'm trying to use the _middleware to create some dynamic pages based on the subdomain.
or would I have to use a workers?
You need to use Workers with a Worker Route
Thanks tried it now it's working 🙏❤️