Serve static files from a cookie less domain

Written by
Date: 2012-06-02 13:01:00 00:00


When I was a child, I used to spent hours on Saturday's afternoons with my dad. He was usually working at this Ford pickup's motor.

He always wanted it to work as a swiss clock, no strange noises at all. He usually worked cleaning the carburetor. He cleaned it, made adjustments, then turn the engine on, went to the tailpipe and listen. If the motor was not running as smooth as he wanted, he started to made adjustments again.

I think part of my inheritance is that compulsion to have my server and webpage working, as smooth, as my knowledge allow me.

Today I've working in getting my css files served from a cookie less domain, so I created static.garron.me. The problem was that Yslow was still saying my that I needed to take css files out of the domain with cookies.

After researching a little, I realized that the culprit was Google Analytics and utma, utmb, utmc and utmz cookies. Those ones were set for the root domain garron.me instead of www.garron.me.

The solution was really easy, look at the java script code and look for this line:

_gaq.push(['_setDomainName', 'www.garron.me'])

Be sure it says www.yourdomain.com instead of just yourdomain.com. This is of course only valid if you are not running your site at the root domain. If that is your case, you will need to buy a new domain for your static assets.