CNAME other domain with my subdomain with masking

Posted June 13, 2017 4.2k views
NginxPHPDNSUbuntu 16.04

im stuck with a particular issue here. i have posted it here before, but didnt had time to follow up. now im really stuck and need solution badly.

you see i have a ecommerce solution where each of my customer have their own site hosted on my subdomain. eg.,

now i want to have my customers own domain to CNAME with my sub-domain. eg. will work as, will work as

i tried with cludflare few things,
i added in cloudflare as CNAME
Name( Value (
it works actually, but when i type on browser, the url change to is it possible to keep the url in browser something like url masking.

if its possible, please guide me a bit. if not possible in cloudflare, please suggest me how can i achieve that in alternative way.

thanks in advance.

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
1 answer

Hi @newbie

Nginx right? And which ecommerce system are you using?
Can you post your Nginx server block of Change the domains if you want privacy.

  • @hansen
    thanks for replying.

    here is my nginx server block

    if you want detail insight, please give me your email and ill give you original domain name.

    • @newbie

      Okay, you’re actually redirecting HTTP traffic to HTTPS, but by doing so, it’s actually redirecting any domain in the server_name to the first domain of the list.

      So it’s actually doing this:

          return 301$request_uri;

      If you change around, it’s putting primary focus on instead:

          return 301 https://$server_name$request_uri;

      And I’m not sure how you handle the include snippets/ssl-wildcard.conf; for two different domains, but that is in general tricky within the same server block.

      But the main question is actually; do you want to be able to use at all or is the only focus actually
      If you only want, then simply remove and you’re done.