skaz
skaz

Reputation: 22580

Subdomain per client?

I am making a web application that will (hopefully) service many clients. At first, I was going to have mydomain.com be the landing page for login and have one massive database for all users, but then I anticipated the downsides to this approach. I thought to BaseCamp, for example, which, when you sign up, gives you a subdomain for your "instance" of the product, such as myclientname.basecamphq.com

My questions are: does BaseCamp have its own separate web application for each instance, with its own separate database? Does anyone have any useful guides to setting up this process?

Thanks.

Upvotes: 1

Views: 2734

Answers (2)

Xaqron
Xaqron

Reputation: 30857

If you are gonna have sub-domains, yes each of them would be a separate web application in IIS. The underlying concept is about how IIS handles requests with the same IP but different addresses. IIS reads the Host HTTP header and if it is s1.example.com then it refers to the peper application based on bindings. Having separate databases is a decision up to you.

If you conceptually don't need separation, don't do it because of technical issues. Also it is possible to get users separated based on a ParentId in database (a one-to-many relation between tblCustomers -> tblUsers).

Managing multiple databases/subdomains has more headaches than a bing integreated solution (just consider a change in database design or changing IP address of server and setting up DNS records).

Upvotes: 1

Antti Huima
Antti Huima

Reputation: 25522

Have a DNS server that maps all the subdomains to the same IP. Then grab the subdomain from the HTTP request (name-based virtual hosting). If there is absolutely no interaction between different subdomains you can have individual databases for everyone. this makes also per domain backups easy. If there is also common state and/or iformatiom exchange between subdomains you might want to have a shared database instead. Having separate databases with separate access credentials also improves security somewhat.

Upvotes: 0

Related Questions