Rakhim
Rakhim
CDCloudflare Developers
Created by Rakhim on 10/22/2024 in #workers-help
Wildcard DNS + Worker + R2 custom domain
No description
4 replies
CDCloudflare Developers
Created by Rakhim on 9/13/2024 in #workers-help
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 Any request to 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 of the request and make routing based on that. But the Host is always just 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 has a Host value of localhost, not bla.localhost. Running wrangler with --host argument just changes the host, but never fixes the missing subdomain.
7 replies