Custom domain for customers

Hey Guys! So I’m planning to use Netlify’s custom domain features for a Nextjs site I’m deploying.

I happened to read this thread https://answers.netlify.com/t/support-guide-best-practices-for-using-your-customers-hostnames-on-the-netlify-site-you-build-for-them/43190

So I’m looking at the “Another option” mentioned here where I have a customer’s website hosted at mydomain.com/customer1

So customer would want to setup a custom domain like service.customer1.com. According to the “Another option” case in the above thread, does that involve me creating a separate site for the customer or I could add to the current site itself.

Could you walk me through the process?

You can get “Wildcard subdomains” feature. It can be activated, but there are a few requirements:

  1. The site must be on a Pro or above team.

  2. The DNS must be managed by Netlify OR you need to bring a custom wildcard SSL certificate.

  3. The site should not have any domain aliases or branch subdomains.

  4. The primary domain of the website should be on the same level as the required wildcard domain. For example:

If you need the wildcard to be *.bar.domain.com where * can be your wildcard subdomain, the primary domain must be www.bar.domain.com (www can be replaced with any string).

  1. You need to configure the DNS for the wildcard subdomain even in case you are using Netlify DNS. You can follow the external DNS configuration for subdomains and add a CNAME entry with * as the hostname or any other value that you want. The value of this DNS entry should be the Netlify site address.

If that sounds like something that would work, please let us know and we’d enable it for your site.

Sorry I couldn’t understand a few parts.

  1. Currently our own DNS is hosted on Namecheap. So would I have to bring a wildcard SSL certificate or the customer? I’d want it do on my end on behalf of customer. So how to bring such a certificate?

  2. And I couldn’t get the wildcard part. For example I have a customer’s website hosted on netlify configured with the domain of our website “https://brand.com/chapman” but the customer wants it on a domain like “https://chapman.com”, so how would that work here?

You’d have to bring a wildcard SSL certificate. More on that here: HTTPS (SSL) | Netlify Docs

The second point in your list would not easily work. To do that, you’d have to add a domain alias for your site, and that has a list of about 95 aliases. If you’ve more customers, you’d have to setup a different site and add more domains there. Wildcard on the other hand, has no limit. You can get unlimited customer.your-domain.com.

  1. So here with wildcard how does Nextjs find out the route? Internally Nextjs has [url] file where in case of “https://brand.com/chapman”, the url is taken as chapman but upon wildcard redirect of chapman.com configured on customer’s end, how would nextjs get the url path?

  2. And also with domain aliasing, would the customers custom domain become “chapman.com/chapman” rather than chapman.com?

Hi @Goutham

  1. You would have to try this out yourself first i’m not sure if that would work
  2. Yes you can set our your domain aliasing with redirects either way. It’s up to you.