-1

I have a SAAS application which has 3 different subdomains.

example.com 
app.example.com
support.example.com 

I want to White Label the services only in support.example.com

Example: testcompany.com requires services to my support.example.com

To achieve this, I need something like support.testcompany.com which should basically load the support.example.com website.

I have created a CNAME record in testcompany.com DNS, pointing to support.example.com

But example.com is being loaded instead of support.example.com

How do I solve this? Is this the right way or is there any other approach?

1

A DNS CNAME record only points a hostname to the same server that the target hostname points to.

It does not automatically configure the web server to load the same websites for both hostnames. That takes additional reconfiguration of the web server software, i.e. Apache, Nginx

(You circumvent that issue somewhat by designating one website the default VirtualHost that will always get displayed when unknown hostnames are used to access the web server, but that only works for plain http, not so much for https)

  • example.com renders <p>Website</p> and support.example.com renders <p>Support Website</p>. Both are includes in sepearte index.html files, I have my Apache server configured to handle the subdomains. But the CNAME record pointing from support.testcompany.com is rendering example.com content instead of support.example.com content. – Anirudh May 1 at 12:54
1

It doesn't matter whether you use an A record pointing to the same IP address or a CNAME record pointing to another hostname that eventually points to the IP address. The browser will always send a Host: HTTP header containing the hostname in its address bar.

Therefore, your VirtualHost for support.example.com needs an alias for the other hostnames, e.g. support.example.net and support.example.org.

<VirtualHost *:80>
    ServerName support.example.com
    ServerAlias support.example.net support.example.org
    . . .
</VirtualHost>

Otherwise, the webserver will show the default virtual host, which in this case seems to be example.com.

It might also be a good idea to have a default catch-all virtual host to prevent every hostname pointing to that IP address from showing the contents for example.com. Your current configuration might affect SEO and it could have security issues, too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.