I'm thinking of implementing tenant-specific subdomains.
So when a new customer registers they have to enter what "organization" they belong to. That organization's name will be the subdomain.
A customer registering using "acme" will get acme.productdomain.com as their specific domain.
The idea is that it could give the user a bit more ownership and maybe nudge users to invite more persons from their actual business organization?
It would also make it easier for people to add a cname and easier to implement SSO etc. Even if I'm faaar from needing those kinds of features ... 😊
So, what do you think?
What's your impression when using a product that uses tenant-specific subdomains?
Do you feel it could lead to some of those benefits mentioned or is it just a waste of time?
It depends on what the subdomain is for, if it's for hosting their own "thing" like a website, API or similar then it makes a lot of sense to have it early on since it's not very hard to implement (easy SSL with a wildcard certificate) and it can offer a sense of ownership to the user.
Just make sure you use a different root domain than your main website, for example for my project https://bluegenie.co, I use the http://bluegenie.dev to host my users' content. This is because I might need some of the subdomains later, like
api.or whatever.Even if you never need any of the other subdomains for yourself, there are security advantages to keeping user content on another domain. Github learned this lesson and moved their hosted pages from github.com to github.io. They wrote about their reasons for the move here:
https://github.blog/2013-04-05-new-github-pages-domain-github-io/
It's important to think about this early on. I would personally keep everything under the same domain but block the most important subdomains (api, www, mail, admin and so in) in advance so they can't be claimed by users.
I thought that I could have a DNS entry that would catch all subdomains except those I've specifically routed elsewhere? So that having all one the same root domain would be fine?
Or have I misunderstood something?
https://serverfault.com/questions/575603/it-is-possible-to-point-some-specific-subdomains-to-a-dns-server-using-wildcard
Yes of course, that should work fine to implement technically, the problem comes when someone takes a subdomain that you later need for yourself. you're going to have to take it away from them somehow.
That's true. I need to block a few. Wouldn't have someone sign up for the org "www" ☺️
I have been using it in a project and I just love it. We have over 200 customers and the we let the customers choose there own subdomains. Besides the subdomains they are also alloweds to have an alias as well. We need this in some cases when they change there company name for example.
Beside the domain name we also use the tenant separation in the database. So each of our customers have there own SQL database. So in this way we could easily move bigger customers to there own machines.
It's hard to say for sure without knowing more about your product. From a purely technical point of view, managing tenant-specific subdomains is a PITA that rarely becomes worth it in the long-run. Consider the overhead of testing this both in development and in production.
As others have said below, hosting user generated content would be the obvious use case. But even then, tenant-specific subdomains are not always required.
I'm facing this exact design decision right now myself so interested to see the different opinions here. I am primarily for it, my main concern is whether it's going to cause any problems in future app integrations with third-party tools/APIs which rely on Oauth ' apps to be defined along with callback/redirect URLs.
I'm thinking of things like Zoom, Dropbox, Drive, Quickbooks, etc. In some cases, you can provide redirect URLs when initiating the OAuth process, other times you have to predefine them and in the worst case, there might only be one allowed.
I'd love to know if anyone else has faced similar dilemmas.
I’ve done this on my last 2 projects, and I think it works very well. Of course it comes down to your intention and business purpose behind it, as some of the other comments have mentioned. But implementing it wasn’t too challenging and I believe the clients appreciate it.
Depending on your DNS and hosting situation it could be more or less difficult to implement. I’m using Vercel and it was quite easy to setup, and they handle the auto SSL for all subdomains.
The only other problem I see is the Slack issue of later trying to connect different orgs. So you log into one org at one subdomain but really want to see several orgs on one page.
Yeah. I see that. My thinking was to have a dropdown in the header where one can switch between orgs one might own or be part of. Do you think that could solve it?
Yep, that would function. Just be aware your UX becomes tied to this fact. You just need to look at your particular use case and decide if you'll be okay with that. (I just have to deal with 3 different slack orgs daily due to acquisitions so it's top of mind for me)
It makes it feel a bit more premium having that I feel. If it's a multi tenant platform the alternative is to have them enter that on login screen which some then might forget.
From doing similar on another project it makes sense. Any document download links are subdomain.product.com so users that exist in many places then need to log in to the correct tenant.
Just factor in the wild card ssl costs to out way the benefits.
I think if you have a B2B and your customer have mulitple users, then it is even expected. something like *.app.domain.com record with a wildcard certificate: *.app.domain.com which you can get from letsencrypt via a command line and a TXT record.
Now, you just raised 1 criteria. What about SSO for these domains, Schema separation of data, etc...
You can get drowned with details pretty fast. My suggestion: just start with what you know, less to maintain, just get it out there. When you feel your customers needs it, it would be an easy move and perhaps they will be happy with their new present. I am very disappointed with SAAS sites which takes big money for SSO which actually says, you want security? pay. What?
Good luck!
Unless you're building (or will transition to) a "proper" multi-tenant app (i.e. each customer is on their own server and/or database), the additional complexity (e.g. wildcard SSL) with each customer having their own subdomain might not be worth it.
If you're curious, reasons for choosing to go "proper" multi-tenant include:
I’d add to this some orgs will outright refuse to have their data hosted on the same server as other orgs.