Medet Tleukabiluly
Medet Tleukabiluly

Reputation: 11950

How do sites like shopify.com, github.io, volusion.com, support multiple subdomains per user?

I like the idea that third part apps run at *.github.io *.shopify.com *.volusion.com works, people make own pages (modify/use template), and host inside. I'm interested in architecture, how all of this happen?

Upvotes: 1

Views: 779

Answers (1)

Nate Barbettini
Nate Barbettini

Reputation: 53690

This is called multitenancy. It can be achieved in a number of ways with on many different server platforms. There are a number of pieces, for example:

  • URL rewriting rules handled at the load balancer or web server level to let *.site.com act as site.com/users, or something to that effect depending on your platform architecture
  • A database of tenants (users) and their associated account names or subdomains
  • Routing or resolution code that conditionally switches the database connection (or tables, or security modifiers, etc.) per request based on the calling tenant

Ultimately, a tenant is just a row in a database table somewhere, and the application is written in a generic way so that each tenant uses the same "base" code. How that works and how it is implemented can vary greatly between applications.

Update: Per your comment, here are some resources specifically dealing with tenancy in ASP.NET:

Upvotes: 2

Related Questions