Run worker on non-owned subdomain/zone

I’d like to build edge applications on CF Workers and enable my customers to consume those as SaaS with as little effort on their part as possible. Could my customers simply point a subdomain of theirs, which may or may not be managed via CF, at my CF account via setting that subdomain’s DNS entry via CNAME to my CF-managed domain/zone, and CF would happily accept requests to that subdomain and route them via my zone, as usual? (It seems that using CNAME with my sub/domain in it should count as “authorizing” my zone to handle those requests, from the perspective of CF?)

Because right now, assuming that such a feature does not exist, it seems like I have to either:

  • have the customer sign up with CF or use their existing CF account to create a “forwarding” worker from their zone to mine (if I want them to have the benefit of user traffic never having to route away from the edge unnecessarily) – but this creates additional complexity and work on the customer side, and customers may have little technical skills or understanding or resources;
  • OR have the customer point their DNS at some non-CF physical or cloud server that belongs to me, which merely acts as a proxy, sending traffic back to the CF edge (which is bad architecture, loses edge benefits, scalability benefits etc)
  • OR I need to force the customer to use a subdomain provided by me, which may be unacceptable for various reasons (like SEO, or because they want to not disclose the service they are using under the hood, or because they want to resell / white-label…)

Is there any way to accomplish what I’d like right now? Are there plans for supporting such deployment scenarios in the near future? Am I looking at this the wrong way?

Thanks
Denis

You could achieve this with SSL for SaaS and Cloudflare Workers. You will have to get in touch with Support as there are some requirements.

6 Likes

Super nice, this is EXACTLY what I was asking for. Thanks, adaptive, and thanks Cloudflare for being awesome!

EDIT: Just to clarify: There is no need to get in touch with support for the “custom hostname” feature to work. You just go open up the domain in your dashboard, go to SSL > Custom Hostnames, I think enable that feature and accept the billing terms ($2 per subdomain per month), add a default/fallback origin and then you can simply add the custom hostname and it just works. (If using Workers, ensure to add a new route for the new hostname that’ll be used for these requests.)

2 Likes

Cloudflare Apps used to support workers - so you could easily bill users and let them use their custom domains and even combine with other CF Apps. It seems to have been shelved and I haven’t heard anything about its future.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.