Multi Tenancy using edge functions

Hi There,

Looking to create a multi-tenant application. Hoping to host a single copy of the app on Netlify and then serve dynamic content based on the request.

Ideally the user signs up and is granted [some-random-domain] The hope is that this can be masked with another domain so that requests to display the content from [some-custom-domain] with the custom aspects of the content being generated dynamically from the db based on the request. Is this an appropriate use for edge handlers? Reading the documentation it seems like this should be possible? Hoping to get some more feedback on how to best approach this problem using Netlify.

I’m not writing the feature, but I think that Edge Functions will be short-running (milliseconds, not seconds) and what you sound like you appear to want to do is proxy (differently based on hostname, but still proxy), so I am not clear it will be a good fit considering that your site is not always servable in milliseconds (larger assets take longer, as do poorly connected clients and other things like requests authenticated using Basic-Auth). If you used a 301 redirect that could work a bit better, since the edge function would be “done” quickly based on that database lookup & nothing else.

Edge Functions are also not the part of our system that handles SSL provisioning, so it is not clear that you’d get any benefits from doing so (I think you’d still have to configure or upload certificates for all hostnames on your Netlify site).

You can assign up to about 50 names to any netlify site, so I’d recommend assigning them directly and letting us provision SSL for all of them as a group. This doesn’t scale super well - you need one site per ~50 hostnames - and you will be spending a substantial amount of time doing tech support for your customers around DNS configuration based on experiences from other customers who’ve tried your path.

An easier way forward is our “Wildcard Domain” feature, which would require you to use ONLY type hostnames, but would cover ANY number that match the * pattern (on a single site). This is a lot easier to configure, but I understand it may not meet your business needs.