Having to register staticexample.com instead of using static.example.com feels like there's some fundamental flaw in the browser model.
Is there a better fix that browsers and servers can start with now? Maybe in a year or so time, there will be no need for such kludges.
A cookie has a domain field, that applies to subdomains. So, eg, domain=example.com is used for static.example.com, but domain=www.example.com would not be. So the "solution" would be to not use the root domain for dynamic pages.
"domain=example.com" does not match static.example.com, but "domain=.example.com" does. The problem here is authors who just used wildcards everywhere (so they could skimp on the work to design their URL namespace) and are now regretting that.
I'm testing with Firefox, and if I set a cookie domain to "example.com", I get ".example.com" anyway. If I set a cookie domain to null, Firefox does set it as "example.com" and not ".example.com". Requests for a file from "static.example.com" do not include the cookie from "example.com".
I think that is probably the last optimization you want to do. Reducing the size of the response, recompressing images, gzip encoding, good browser cache headers, server side caching, etc. will yeld better results.
To my knowledge, using S3 and/or cloudfront accomplishes this as well. Can anyone confirm or disprove that?