0

I've built an application and planning to host it at example.com I have about 10 customers who want the application to be hosted on their brand name (White labeled). Instead of deploying the same application 10 times, I would prefer hosting the application at example.com and point the CNAME of each of the customer's domain to example.com

I implemented the same but for some reason, that's not working as expected.

My Current Setup:

customer1.tld.          60      IN      CNAME   prod.example.com.
prod.example.com.       59      IN      A       62.xx.xxx.204

When I hot prod.example.com on a browser, it works seamlessly, however when I enter customer1.tld it's not working. Logic - customer's dns (CNAME) should point to my hostname and my hostname (A record) should point to my server IP. Anything that I have missed out?

Other Related Information that I'm using:

  • VestaCP
  • Ubuntu 16.04
  • Apache/2.4.29
Harry
  • 103
  • 1

2 Answers2

0

The web server needs to be aware of all these aliases: list them on the ServerAlias directive of the <VirtualHost> of your application.

<VirtualHost>
    ServerName prod.example.com
    ServerAlias customer1.example.net customer2.example.org

    . . .
</VirtualHost>
Esa Jokinen
  • 46,944
  • 3
  • 83
  • 129
0

CNAMEs are not allowed at the apex of a domain. So you need to do it like this:

customer1.tld.          60      IN      A       62.xx.xxx.204
customer2.tld.          60      IN      A       62.xx.xxx.204
prod.example.com.       59      IN      A       62.xx.xxx.204

www.customer1.tld       60      IN      CNAME   prod.example.com.
www.customer2.tld.      60      IN      CNAME   prod.example.com.

Some cloud-based DNS services like Route 53 offer a new service called aliases that can be used to get around this problem, as they allow CNAMEs at the apex that way.

Stuggi
  • 3,506
  • 4
  • 19
  • 36