This page may be out of date. Submit any pending changes before refreshing this page.
Hide this message.
Quora uses cookies to improve your experience. Read more

How can we implement the "Your own Domain name" functionality in our SAAS web application?

4 Answers
Rob Polak
Rob Polak, Developer - Amazon

Find a domain registrar which offers an API integration. Their api guides will show examples how to easily buy domains using https requests. However, you are going to run into some tricky issues:

  1. Who owns the domain? - When a user buys a domain are you holding the domain, or registering for them? If they need to own the domain you will have to register as a domain reseller. Which means you are acting as a proxy between the registrar and end user who is buying the domain. You would never take posesion of the domain.
  2. Legal Issues - If you are holding ownership of the domain you are opening yourselves to some legal issues. For example, if i register a domain slandering a celebrity, that celebrity could sue the domain holder for damages. I am not a lawyer, and this is not legal advice, you should consult legal coucil.

If this is just a proof of concept then I think you are good to go, most large domain registrars offer an api integration. You should review each api with your team and decide which one you like the best.

Tom Jessessky
Tom Jessessky, web developer for hire, learned from many failed startups

I have never actually implemented this, but I have considered how to do it. Here is the high level overview of the method I believe would work:

  1. Use a DNS provider with an API such as CloudFlare.
  2. When a new customer registers, validate their desired companyname.yourdomain.com against the existing subdomains to make sure it’s available by calling the “List DNS Records” API.
  3. If the domain is available, call the “Create DNS Record” API to create an A Record with the desired subdomain in the “name” parameter and your server or load balancer IP address in the “content” parameter.
  4. Depending on your server, you’ll have to set up routing rules or virtual hosts to display the correct content when someone visits those new subdomains.

Note: I am not an affiliate of CloudFlare, I just use them personally and have been really happy with the service. The free tier is all I’ve ever needed. I highly recommend them for DNS.

William Hurley
William Hurley, Developer and manager of developers. Building for the web since 1996.

I would recommend you do not get involved in handling the registration of fully qualified domains. Instead either do subdomains or have people point their domain at your domains with a CNAME. From there you need to have something in your application that maps the domain to a logical set of functionality. For instance you would need users to have a reference to the account / domain.

Of course if you wanted to get really fancy each account would be set up as a container or set of containers that are routed to by a load balancer. That way you don't have to worry about application level routing.

John-Paul Anderson
John-Paul Anderson, I know a few things

Ive had to do this on my getinvoicer application. Its being hosted on AWS.

this may help you out How to configure dynamic Subdomains for SaaS Product using wildcard?