Are there any security reasons against "drop-www
"?
In other words, are there any security reasons against using an apex [1] domain name such as example.com
instead of a subdomain such as www.example.com
?
Quote https://www.bjornjohansen.com/www-or-not
Cookies are passed down to subdomains Cookies set from a hostname, will also be sent to all subdomains. I.e. if the website on “example.com” sets a cookie, the browser will also send this cookie when visiting “www.example.com”. Sounds like a good thing, since it’s the same website anyway, right? But the cookie will also be sent to “cdn.example.com”, to “email.example.com”, to “intranet.example.com”, to thirdpartyservice.example.com and so on. And a lot of third party services let you use your domain exactly like this.
A cookie set from “www.example.com” will not be sent to any “sibling” hosts like above. Your browser understands that they are not “subservices” but completly different services, and should not get access to your cookies.
Is this still the case? Can this be solved?
Are there other non-cookie related security issues with using the apex domain name instead of a subdomain?
[1]
- github says
-
An apex domain is a custom domain that does not contain a subdomain, such as example.com.
-
- https://stackoverflow.com/questions/55461299/what-is-the-correct-term-or-apex-naked-bare-root-domain-names