-1

I have registered a domain, say myDomain.com, and I want to try out how CNAME works. I changed the CNAME of www.mydomain.com in GoDaddy and let it point to another domain, say Amazon.com, but when I try to visit www.mydomain.com, it displayed "this site is not currently available".

From what I've read here about CNAME, it seems such a setting should be valid. I wonder what is the reason and is it really possible if I want to let such a setting work.

I am also curious, if it is really possible to let www.mydomain.com point to www.amazon.com, when the request is sent by the browser, what value will be in the Host header, will it be mydomain.com or will it be amazon.com?

5
  • The Host header contains the original domain name. The server you pointed it to may not have any virtual host with that name. Commented Nov 28, 2019 at 21:19
  • Thanks and that's what I suspected. However, in the reading I listed above, "Many hosted services provide a subdomain for each customer on the service provider’s domain (e.g. company.hostname.com), and use CNAME to point to the customer’s domain (www.company.com).". hostname.com will be sent in the Host header to the server that hosts company.com, how can this server recognize the request and route to the correct page?
    – SamTest
    Commented Nov 28, 2019 at 21:24
  • Plus, in this case, won't hostname.com's cookie be sent? How would then company.com maintain user session?
    – SamTest
    Commented Nov 28, 2019 at 21:25
  • Is this all about managing IT systems in a business environment?
    – Marco
    Commented Nov 28, 2019 at 21:30
  • Just as you said: a Host header is sent to the web server. The web server uses that name, when it needs too, e.g. when sending cookies. Commented Nov 28, 2019 at 21:31

1 Answer 1

0

CNAME record in DNS cannot be used to redirect domain to another one at HTTP level.

CNAME is used to manage aliases in domain names so they all point to a single IP address.

If you want to redirect browser from domainA.com to domainB.com, you must define it in your webserver (eg HTTP Redirect, URL Rewrite, etc) or buy an appropriate service from hosting provider.

You must log in to answer this question.

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