setup CNAME redirect or custom domain with url masking

Posted May 8, 2017 23.7k views
NginxDNSUbuntu 16.04

we have an ecommerce app where customers store is located in

now how can i offer my customers to have their custom domain to be treated as allies with that sub-domain.

for example, will resolve with url masking.
meaning will serve exact content of without changing url.

i tried with adding CNAME record pointing but that didnt worked.

i should add, is on https and most likely customers wont have any server to setup ssl for their domain.

i would really appreciate some help here.


These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers


Pointing a root domain, such as at a sub-domain is referred to as CNAME Flattening. It can be also be achieved using an ALIAS or ANAME record, though many DNS providers do not yet provide support for such (DigitalOcean doesn’t, yet).

The two work-around options would be to use CloufdFlare for every domain – they allow you to point a domain to a sub-domain using a CNAME entry – or use a plugin, if one is available for your app.

There are other DNS providers, such as DNSMadeEasy and DNSimple, though I believe they cost as much if not more than the premium plans offered by ClouldFlare.

Although it’s an extra step and they would need to allow CloudFlare to host the DNS for their domain, it can be achieved through them, even on the free account.

  • @jtittle
    thanks bro.
    im already using cloudflare as DNS service. and i could ask my customers to add their domain to cloudflare as well. thats not a problem.
    but unfortunately it didnt worked for me. check my earlier email, i tried that cname on cloudflare.

    and im not only talking about root domain. customers root domain & subdomain both needs to be allies with my subdomain.

    for example allies with allies with


With CloudFlare, as long as the www entry is setup as a CNAME pointing to the main domain that you are flattening, it should work as any CNAME would under normal circumstances.

That being said, it does appear things have changed with CloudFlare so normal CNAME setup for www may not work with the flattened CNAME. The Pro plan offers more features it seems and the ability to flatten all CNAME entries, which may be what you actually need – but it comes at a cost of $20/month per domain.

The alternative would be to check with other DNS providers, such as DNSMadeEasy or DNSimple and see what their costs would be for similar solutions – or use a plugin / build one that will work for your application.

If more providers supported flattening, ALIAS, or ANAME, this wouldn’t really be an issue and you wouldn’t need to rely on CloudFlare, other DNS providers, or code-based work arounds, but not all do just yet.