News for hackers. Stuff that matters.
Re:Small things add up: 4chan's migration to a cookieless do... by cheald on Monday December 02, 2013 @02:40PM (#6835964)
They don't. You could serve your site off of www.domain.com and your CDN off of cdn.domain.com easily.
Re:Small things add up: 4chan's migration to a cookieless do... by bjt on Monday December 02, 2013 @02:58PM (#6836084)
But then you still have to remain vigilant against a clueless dev or random JS lib on www.domain.com setting a cookie for .domain.com, which your browser will helpfully include with requests to cdn.domain.com. With the completely separate root you're protected from that.

http://en.wikipedia.org/wiki/HTTP_cookie#Domain_and_Path

Re:Small things add up: 4chan's migration to a cookieless do... by sliverstorm on Monday December 02, 2013 @04:05PM (#6836520)
So basically it doesn't have to be that way, but to protect yourself from cluelessness/stupidity, you do it.

Kind of like Unix permissions vs. jails/virtual machines. Both are secure, but one is more secure against incompetence than the other.

Re:Small things add up: 4chan's migration to a cookieless do... by moot on Monday December 02, 2013 @04:08PM (#6836533)
I wouldn't agree. There are completely legitimate reasons to set cookies on *.domain.com -- it isn't "clueless/stupid" to do so, just less ideal.
Re:Small things add up: 4chan's migration to a cookieless do... by sliverstorm on Monday December 02, 2013 @04:11PM (#6836559)
I wasn't making a statement, just trying to clarify and then making an analogy to verify my understanding. I think I omitted a question mark where I should have had one.

Certainly, it is not automatically a bad idea to set such cookies. I see that.

Re:Small things add up: 4chan's migration to a cookieless do... by kibibu on Monday December 02, 2013 @06:26PM (#6837361)
We use wildcard cookies to let users login to www.domain and peek at beta.domain without logging in again. This isn't incompetence so much as reducing user drag. Perhaps I should have set it up to use www.domain/beta/ instead.

Unfortunately, this means our cookies are sent to static.domain. Worse, once we get rid of beta.domain there's no going back on wildcard cookies - there's no way to force clients to expunge cookies.

Re:Small things add up: 4chan's migration to a cookieless do... by cheald on Monday December 02, 2013 @06:38PM (#6837423)
You could use beta.www.domain.com.
Re:Small things add up: 4chan's migration to a cookieless do... by jamesjporter on Monday December 02, 2013 @10:12PM (#6838239)
This makes a ton of sense, but it might be unorthodox enough to scare off some users thinking it was a scam of some sort.
Re:Small things add up: 4chan's migration to a cookieless do... by moot on Monday December 02, 2013 @02:52PM (#6836044)
Correct, but only if you don't set any *.domain.com cookies, which as it turns out most do.
Re:Small things add up: 4chan's migration to a cookieless do... by cheald on Monday December 02, 2013 @06:37PM (#6837418)
Right -- if you're serving your website off of the root, then you're going to have this problem. If you serve it off of www (which, as it turns out, is how domains were originally intended to be used!) then you don't.

It's not an inherent flaw of the tech. It's a flaw in how we use it.

Re:Small things add up: 4chan's migration to a cookieless do... by chrisweekly on Tuesday December 03, 2013 @01:05PM (#6841943)
+1 Use of a subdomain prefix is absolutely the right thing to do, trendy root-domain-only sites notwithstanding.

CNAMEs are inherently more flexible and more resilient in the face of various load challenges or DoS attacks:

"Root domains are aesthetically pleasing, but the nature of DNS prevents them from being a robust solution for web apps. Root domains don't allow CNAMEs, which requires hardcoding IP addresses, which in turn prevents flexibility on updates to IPs which may need to change over time to handle new load or divert denial-of-service attacks. We strongly recommend against using root domains. Use a subdomain that can be CNAME aliased... " - Heroku [https://status.heroku.com/incident/156]