accepting connections from CNAMEd domains to our worker
I’m writing a multitenancy app and some customers want their custom domains to point to their subdomain at
inploi.app
this mostly works fine except i need to add it to wrangler config (or the dashbaord) every freaking time!
is there a way i can avoid having to add those?
Options already considered:
- writing an admin endpoint (and frontend) that automatically adds this using some cloudflare API. this will be undone upon each deployment as wrangler.jsonc takes precedence and overwrites the dashboard stuff
- using a wildcard for the whole domain (not possible)
Will i have to bind these to my deployments, altering the wrangler config file inside github actions to include the list of current custom domains and then deploying it? this seems very counter intuitive and flaky
4 Replies
Are you using CF For SaaS/Custom Hostnames?
yes
wait what are custom hostnames
it's what the tab is called for CF For SaaS, under a zone -> SSL/TLS -> Custom Hostnames
if that's what you're using to setup external domains (Which is the only thing which will work, just wanted to verify), you just need to use a broader route
https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/start/advanced-settings/worker-as-origin/
If you use
*/*, you'll capture all client domains on one route. You could then use *<zonename>/*, service: none to exclude your own domains/subdomains, although imo you should almost always use a separate isolated domain for customer domains/CF For SaaS if you're not already, as it gets way too tricky with rules and such applying to them if you were trying to run your main website/apis/etc alongsideyeah we are using
inploi.app for the multitenant customer sites and inploi.com for the actual company stuff
so */* should technically do the job? i will try that