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
?
Host
header contains the original domain name. The server you pointed it to may not have any virtual host with that name.hostname.com
will be sent in theHost
header to the server that hostscompany.com
, how can this server recognize the request and route to the correct page?hostname.com
's cookie be sent? How would thencompany.com
maintain user session?Host
header is sent to the web server. The web server uses that name, when it needs too, e.g. when sending cookies.