Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing session cookies across domains with CNAME

Let's say there is domain A and domain B and domain A sets a session cookie on the domain .A.com. Now set a CNAME record that points subdomain.A.com to B.com. Will the browser that has visited subdomain.A.com have access to the cookie that was originally set by A.com, even though it is a CNAME that points to B.com?

like image 209
Justin Meltzer Avatar asked Dec 10 '25 02:12

Justin Meltzer


1 Answers

No, CNAME is a DNS-level construct, and browsers do not take that into account at all. All it cares about is the host name in the URL.

like image 96
Wil Tan Avatar answered Dec 11 '25 20:12

Wil Tan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!