ryantbrown
ryantbrown

Reputation: 611

How can we provide a custom domain name for our clients?

We currently have a SaaS application that lives at app.ourcompany.com. I am trying to understand what it would take to let our clients access our application via a custom subdomain like clients.theirbrand.com.

I have done some research and there seems to be a few things in common with other companies that provide this.

  1. They have their clients create a CNAME record that points clients.theirbrand.com to something like clientaccess.ourcompany.com.

  2. Or the application has client subdomains (clientname.ourcompany.com) in which case they have the client create a CNAME that points clients.theirbrand.com to clientname.ourcompany.com

I tried taking one of our extra domains and pointing app.extra.com to app.ourcompany.com via CNAME but it just redirects to app.ourcompany.com.

My question revolves around what we need to do to facilitate this, specifically:

  1. What needs to be done on our clients end via DNS? (just CNAME?)
  2. What needs to be done our end via DNS?
  3. How would we incorporate SSL? (We currently use lets encrypt on app.ourcompany.com) We can secure our side but do clients have steps to take as well?

Update: We are using nginx to serve the application.

Upvotes: 5

Views: 2589

Answers (2)

Alex Rizvi
Alex Rizvi

Reputation: 129

I know its a little late but I was stuck in a similar situation and thought it might be helpful for newbies like me :)

Have a look at: OpenResty

We have two requirements:

  • allocate a subdomain to all new customers (e.g: trumptower.mibuilding.eu)
  • allow customers to bring their own domain (my.trumptower.com)

The first one was pretty easy with Lets encrypt's wildcard subdomain ssl.

The second one was tricky. Since we needed to not only issue an SSL on the fly but also configure our gateway (haproxy at that time) and reload the configuration terminating all active sessions briefly. Mind you, HAproxy and nginx wasn't able to coup with dynamic configurations.

Openresty with lua plugin allows us to do everything above automatically and on-the-fly.

The module we used was: lua-resty-auto-ssl

Upvotes: 5

ryantbrown
ryantbrown

Reputation: 611

So I finally figured this out.

Step 1. Have your client setup a CNAME record that points their.domain.com to your app.saas.com

Step 2. Add their.domain.com to your nginx server block: `server_name app.saas.com their.domain.com; and reload nginx

I am now working on setting up SSL for the extra domains and will comment when I figure it out exactly.

Edit: SSL is working with a SAN Let's Encrypt certificate installed on the server.

Upvotes: 2

Related Questions