4 ms·
Reasons to use www: * Cookies for the root domain get sent to all subdomains, so a subdomain for static content still gets flooded with cookies, slowing down r
by peterwwillis 10y ago
Reasons to use www:
* Cookies for the root domain get sent to all subdomains, so a subdomain for static content still gets flooded with cookies, slowing down requests. Now subdomains will get cookies you may not want them getting, complicating site design. You can end up sending dozens of kilobytes of cookies with each request due to the www-less cookies. The way around this is buying whole new domain names just for static content, and then duplicating SSL and all the other requirements for this new domain. Or hoping RFC 2965/6265 won't break anything using your site.
* There is a security boost by the same-origin not allowing a subdomain to hijack cookies for the root domain ("forums.foobar.com" could be made to set a cookie that "foobar.com" interprets, which can be used to hijack user sessions; this would not happen on www). This problem affected Github and they had to implement complicated workarounds.
* It is easier and more flexible to configure a round robin of frontend hosts with a CNAME (on www) than by A records on the root domain. If your cloud hosting provider's IP changes, they can change their hostname records without needing to modify your DNS records - less work for you and them. And if you think a single static anycast address could never have a routing problem, think again.
* Google will (or did in the past) ding you for duplicate content. The same content on foobar.com/ and www.foobar.com/ will appear as duplicate. Providing the content only on www separates it from other content and makes it easier to search subdomain-specific content. (This won't happen if one of them is 301 redirected to the other, however)
Reasons not to use www:
* "It looks cleaner."
People, you can 301 redirect your www-less site to www, gain all the advantages of using www, and the only "hassle" will be in how the address bar looks.
- iaml 10y agoThis comment convinced me to switch to www while article and other comments didn't. Thank you for a detailed reply.
- z3t4 10y agoYou need A records for DNS round robin. http://serverfault.com/questions/574072/can-we-have-multiple-cnames-for-a-single-name http://serverfault.com/questions/574072/can-we-have-multiple...