Why am I here?

2static.it (To Static It!) is a free service for improving the page-load performance of your site by addressing one specific performance detractor -- cookies on static asset requests.

Me likey cookies!

When you set a cookie on your site's domain, for every single request the browser makes using that domain, it will forward along all defined and valid cookies in the each request. Cookies can be anywhere from 150 to 500 (or more!) bytes in a request, which means they increase the overhead and slow down each request. It's important to note that this is about the cookies the browser forwards along with requests, not about any cookies a response may or may not send back down the wire (although static assets also shouldn't set cookies!)

For most sites, static assets (JS, CSS, images, etc) do not require any session or cookie information to be retrieved, which means that for those requests, this cookie information is needless bloat that slows down your site's performance.

YSlow and others who deal in web performance optimizations generally recommend creating a separate sub-domain to load your static assets from, so that those wasteful cookies aren't slowing down such requests. For example, you may set up "static.mydomain.tld" and reference all your assets with an absolute URL using that sub-domain. This is definitely an important strategy to consider on your site. In addition to preventing cookies, it also allows your browser to make more requests in parallel, which will improve page-load performance across the board.

Cookies, cookies everywhere!

The problem is, deviously simple cases exist where cookies get set in such a way that a sub-domain won't shield you from the cookie bloat. One such circumstance is when you, for various reasons, set a "global cookie", basically one whose domain starts with a ".", like ".mydomain.tld". The intent here is that you want that same cookie to be shared across more than one sub-domain (such as the "www.mydomain.tld" and "domain.tld" versions of your site).

It's very common for session cookies to be set in this way. Another example is if you use Google Analytics (or other metrics packages) and you tell the package to track across various sub-domains, usually by setting a domain like ".mydomain.tld". If that looks eerily similar to cookie setting, it's because that's how the metrics packages generally accomplish the tracking, by setting a "global cookie" for you without you knowing it.

Unfortunately, the catch-all nature of setting a "global cookie" with ".mydomain.tld" is that the cookie will be forwarded along with requests for all sub-domains, no matter what. This defeats your attempt to shield static asset requests from unnecessary cookie bloat weighing them down.

Too many cookies makes my tummy hurt!

The only answer is to have a completely separate domain, one which you do not track or use cookies on in any way, and load your assets via that domain. This will prevent cookies from being included in such requests, which will speed up those requests. You may have spare domains sitting around and don't mind using them for this purpose. If so, get to it!

But if not, that's why 2static.it exists, to provide you with a free domain (a sub-domain of 2static.it) of your choosing, which you then point back at your site's domain root as an alias. You then change all your static asset load references to use this absolute URL, and you will magically strip away unnecessary cookies from the requests. Your site performance will improve and your visitors will thank you!

Have your cookies and eat them too!

It's incredibly simple to do, and yet the performance gains will impact every single visitor to your site! Why not get started right away!?

Still have questions?