© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Cloudflare DevelopersCD
Cloudflare Developers•2y ago•
6 replies
Rakhim

Wildcard DNS with workers on a custom domain

I found a bunch of discussions, but still confused. I have a worker with a custom domain and a route defined:

route = { pattern = "*example.com/*", zone_name = "example.com" }
route = { pattern = "*example.com/*", zone_name = "example.com" }


And I have the DNS set for
AAAA * 100:: Proxied
AAAA * 100:: Proxied


Any request to
anything.example.com
anything.example.com
now get routed to the worker and it responds. So that works. I am trying to make my app route to different handlers depending on the subdomain (my SaaS has subdomain per user, and the app is written in Hono).

My idea was to check the
Host
Host
of the request and make routing based on that. But the
Host
Host
is always just
example.com
example.com
, without the subdomain, and my in-app routing fails. What am I missing?

Developing locally it's a similar story: request to
bla.localhost
bla.localhost
has a
Host
Host
value of
localhost
localhost
, not
bla.localhost
bla.localhost
. Running wrangler with
--host
--host
argument just changes the host, but never fixes the missing subdomain.
Cloudflare Developers banner
Cloudflare DevelopersJoin
Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news
85,042Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Wildcard DNS + Worker + R2 custom domain
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
16mo ago
Workers on Custom Domains
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
3y ago
Workers Custom Domain issue
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
3y ago
Static Assets on zone with domain wildcard
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
14mo ago