1. Home
  2. Blog
Blog

Why Tenant Workspaces Should Live on a Separate Root Domain

In a multi-tenant SaaS, workspaces on subdomains share a site with your app. Why tenant workspaces belong on a separate root domain, and how to set it up.

By Aadesh Kumar 8 min read

Short answer: in a multi-tenant SaaS, host tenant workspaces on a separate root domain (like acme.yourapp.app), not on subdomains of your main domain (like acme.yourapp.com). Subdomains are different origins but the same site, so browsers share cookies and trust between them. A separate root domain turns every workspace into a different site and puts a browser-enforced security boundary between your customers and your product.

Every customer in a multi-tenant SaaS gets their own workspace, and one early decision quietly shapes your security: where do those tenant workspaces live? It looks like a branding choice. It is actually a security boundary. This guide explains why, the risks of keeping workspaces on subdomains, how to set up a separate domain, and how we do it at ConectDesk.

Subdomains vs. a separate root domain for tenant workspaces

There are two common ways to give each tenant an address:

Subdomains of your main domain Separate root domain
Example acme.conectdesk.io acme.ws.conectdesk.app
Same site as your main app? Yes No
Domain-wide cookies reach tenants? Yes No
A workspace can set cookies for your app? Yes No
SameSite stops requests from a workspace? No Yes
One abusive tenant can get your main domain flagged? Yes Much less likely
Extra cost None One domain and DNS setup

Both look tidy in a browser bar. The difference is in how browsers decide who trusts whom.

Same-origin vs. same-site: why subdomains aren’t isolated

Browsers have two ideas of “the same place” (see web.dev’s guide to same-site and same-origin):

Many browser protections, including cookies and the SameSite cookie attribute, work at the site level, not the origin level. So every subdomain of your main domain is, to the browser, partly “inside the house”.

That matters because a tenant workspace is full of things your customers control: files they upload, help center articles they write, messages from their customers, and sometimes a custom domain they point at you. One compromised or malicious workspace sitting inside your main site puts everything else at risk.

7 security risks of hosting tenant workspaces on subdomains

1. Domain-wide cookies leak to every workspace

If your app sets a cookie with Domain=conectdesk.io, the browser sends it to every subdomain, including every tenant workspace. A workspace’s page can’t read it with JavaScript if it’s HttpOnly, but the server behind that subdomain receives it on every request. That is a session token handed to someone you never meant to trust.

It works the other way too. Script running on evil.conectdesk.io can set a cookie for .conectdesk.io, and the browser will send it to your main app. Attackers use this to fix a session, overwrite a CSRF token or break logins. Host-only cookies on your app don’t stop a sibling subdomain from planting new cookies next to them.

3. SameSite cookies don’t protect you from sibling subdomains

SameSite=Lax and SameSite=Strict only block cookies on cross-site requests. A request from evil.conectdesk.io to conectdesk.io is same-site, so the cookies go along. If you rely on SameSite alone as CSRF protection, a malicious subdomain gets straight past it.

4. Loose CORS and WebSocket origin checks

It’s common to see “allow any origin ending in .conectdesk.io” in CORS rules or WebSocket origin checks. On a shared root domain, that allow-list includes every tenant workspace, and with it access to authenticated API responses and real-time connections.

5. Phishing that looks exactly like you

A page at login-conectdesk.conectdesk.io that asks for a password looks legitimate, because it is on your domain. Users have been taught to check the domain before they type a password; on a shared root domain, checking doesn’t help them.

6. One bad tenant hurts your domain’s reputation

Safe-browsing lists, email spam filters and corporate firewalls often judge a whole domain. If one tenant hosts malware or phishing, your main domain can get flagged, and with it your login page, your emails and your marketing site.

7. Subdomain takeover has a bigger blast radius

A forgotten DNS record pointing at a deleted service lets an attacker claim that subdomain. On a shared root domain, a taken-over subdomain inherits all the same-site trust described above.

How to set up a separate root domain for tenant workspaces

  1. Buy a second domain just for workspaces. Using a different top-level domain for the same name, like .app next to .io, keeps your brand recognisable.
  2. Keep your own sites on the main domain: website, login, admin, docs, blog and API.
  3. Serve each workspace from a subdomain of the new domain, such as acme.yourapp.app, using a wildcard DNS record and a wildcard TLS certificate.
  4. Make session cookies host-only: don’t set a Domain attribute, so a cookie set on one workspace stays on that workspace.
  5. Replace “ends with” checks in CORS, WebSocket and redirect allow-lists with exact origins.
  6. Point shared callbacks (OAuth redirects, payment and messaging webhooks) at a fixed host you control, not at workspace hosts.
  7. Optionally, add the workspace domain to the Public Suffix List so browsers treat each workspace as its own site, which isolates tenants from each other as well as from you.

The result looks like this:

conectdesk.io            ours: built and run by us
├── admin.conectdesk.io
├── docs.conectdesk.io
└── blog.conectdesk.io

conectdesk.app           tenant workspaces
├── acme.ws.conectdesk.app
├── globex.ws.conectdesk.app
└── ...

Now acme.ws.conectdesk.app and conectdesk.io are cross-site. Cookies for one are never sent to or set by the other, SameSite works as intended, and a problem in one workspace can’t take your main domain down with it. Large platforms made the same move for the same reasons: GitHub moved user pages from github.com to github.io, and Google serves user content from googleusercontent.com.

Security checklist for multi-tenant workspaces

A separate root domain limits the damage of browser-based attacks. It doesn’t replace the basics:

How ConectDesk separates tenant workspaces

ConectDesk is an omnichannel CRM for small businesses where each business gets its own workspace for calls, WhatsApp, Instagram and email. We split our domains along exactly this line:

On top of that, workspace login cookies are host-only, HttpOnly and Secure; the admin dashboard’s cookies are SameSite=Strict and every change needs a matching CSRF header; and real-time connections only accept requests from the workspace’s own origin. Workspaces that publish a help center for their customers do it from their own workspace domain or a custom domain, never from ours.

When is a shared root domain acceptable?

If tenants only type data into forms and you control every line of code and every file served on every subdomain, a shared root domain can work, as long as you follow the checklist above.

Most real workspaces grow beyond that: tenants upload files that are served back from the workspace, publish help center pages, embed chat widgets on their websites, connect custom domains and run integrations. Once that happens, give workspaces their own root domain. It costs a domain name and some DNS setup, and it removes a whole class of attacks.

Frequently asked questions

Are subdomains isolated from each other in the browser?

Partly. Each subdomain is a separate origin, so pages can’t read each other’s data directly. But subdomains of the same registrable domain are the same site, so cookies can be shared or set across them and SameSite doesn’t separate them.

Does SameSite=Strict protect against attacks from a subdomain?

No. SameSite only blocks cookies on cross-site requests. A request from tenant.example.com to example.com is same-site, so SameSite=Strict cookies are still sent.

Cookie tossing is when a page on one subdomain sets a cookie for the parent domain, such as .example.com, so the browser sends it to the main app and other subdomains. Attackers use it to fix sessions or overwrite CSRF tokens.

Do I need the Public Suffix List if I use a separate domain?

Not to protect your main app; the separate domain already does that. The Public Suffix List adds isolation between tenants, so one workspace can’t set cookies for another. It’s most useful when tenants can run their own HTML or JavaScript.

Can tenants still use their own custom domains?

Yes. A custom domain like support.acme.com is already a separate site from yours. Keep the default workspace addresses on your separate workspace domain, and serve custom domains alongside them.

The takeaway

Subdomains are separate origins but the same site, and much of the browser’s security model works at the site level. Keeping tenant workspaces on their own root domain gives you a boundary the browser enforces for you, on top of your server-side tenant isolation.

A separate domain is not just an architecture preference. It is another layer of security.

All posts