-1

I have some problem. I have a CNAME dns record, it pointing to some site, which is alive and running normally. But, when i load it from a browser(all caches and cookies is completely erased), it return to a default cpanel page.

So i try, reset my dns cache, and try to check the record using host and nslookup tool. It look properly directed, and when i try to ping it properly directed to the site.

My question is, why there is difference in the way it resolving?

EDIT

Thanks for @AndrewB for pointing out there is a possible duplication.

Our current system is kinda like this, we have some users, that hosting a page on our system. But the page is accessed by other people(our user have their own customer) which probably doesn't know us. When the page is accessed from our domain(example.com) it works just fine. But few of our user also need a whitelabeling, by using their subdomain(dummy.com) but still serving the page in our domain.

Also, if we told our user to by create subdomain and using something like vhost or htaccess redirection. Then, that would be to complex, business wise, also by using htaccess redirection then the domain would revert back to our domain. Which is not supposed to work like that.

If dns record can't handle http redirection, is it possible to do something like this? If not, how should i approach it?

EDIT 26 March

Currently this question, by using a dedicated ip. The reference about dns alias and configuring web server much appreciated but don't exactly the answer.

Thank you.

2
  • 1
    Possible duplicate of Create DNS alias
    – Andrew B
    Mar 23, 2016 at 5:43
  • Welcome to Server Fault! In many cases mentioning the actual domain name is essential for the community to be able to help diagnose DNS issues. This may be one too. Please refer to this Q&A for our recommendations with regards to how and what (not) to obfuscate in your questions.
    – HBruijn
    Mar 23, 2016 at 18:18

3 Answers 3

1

It seems like you are pointing a name to another name using a CNAME record, but nobody actually told the web server about this, so it ends up serving its default page, because it's not configured to handle requests for that name.

Web servers are often configured to provide different answers based on the name you use to call them (the HTTP host header); this particular web server might be configured to handle www.example1.com, but not www.example2.com; if you use a CNAME record to point www.example2.com to www.example1.com, the request will reach the web server, but then the web server will not know how to answer, and it will either serve a default page or an error page, or it could even not answer at all.

2
  • so, it still necessary to configure the webserver, using a vhost?
    – gamalan
    Mar 24, 2016 at 5:54
  • Yes. Redirecting users with DNS is only part of the issue, you also need to tell the webserver how to handle those requests.
    – Massimo
    Mar 24, 2016 at 13:36
0

Applications (think browser) as well as your OS do cache DNS replies. So you need to find out how to clean all of these. As of browsers, most of them need to be restarted to freshly resolve server names to IPs.

1
  • i already reset both application, and os. the os function does resolve correctly.
    – gamalan
    Mar 23, 2016 at 15:02
0

Is your "alive and running normally" web site under virtual hosting? Assume the web site is www.domain_a.com, even if you map www.domain_b.com CNAME www.domain_a.com ONLY the DNS resolves the IP address of www.domain_a.com when you type http://www.domain_b.com in the address bar. Okay, then your browser connects to the "web server" and say (in the Host header): I want the web site of www.domain_b.com (*** not A, it's still B). No such virtual hosting? Default - CPanel? Maybe.

2
  • not a virtual host, both completely hosted in different server, and have different ip. the one that have the cname is 103.30.245.xxx and the one it pointed is 103.30.197.xxx .
    – gamalan
    Mar 23, 2016 at 15:07
  • If you have www.domain_b.com CNAME www.domain_a.com and www.domain_a.com points to 103.30.197.xxx, then www.domain_b.com will also resolve 103.30.197.xxx; exactly the SAME IP address for both hostnames.
    – Ken Cheung
    Mar 25, 2016 at 17:19

Not the answer you're looking for? Browse other questions tagged .