Setting up a separate domain just to "serve static content from a cookieless domain"

Hi guys,

I’m making progress optimizing our website. We have a Wordpress site with W3TC and we use MaxCDN. One thing that I still have to solve is that our static content, like images, ARE hosted with a CDN through (and etc.). But we have cookies set at and because of this the subdomains have cookies too.

I understand that the only way to solve this is to get a separate domain just for the static files, which is reasonably common it seems. (It’s undesirable for us to move the wordpress site to a www. subdomain.)

This is where my noobness comes in. I don’t know how to go about this exactly.

We need the extra domain, obviously. But do we need extra hosting? With W3TC I can set up the CDN without actually moving the files to a subdomain. It does that automatically somehow. Does that mean I can set everything up with a separate domain and do the same thing, or do I actually need to buy separate hosting and go about it differently?

Any guidance at all would be appreciated.

I hope my questions are clear, but my knowledge in this area is lacking and this makes my thinking cloudy.

Hi Gnusmas,

Yes, you have to spend some (very little) extra money for a further domain, but you can use the same server/webspace. The IP does not need to be different.


How big are your cookies? Unless they are insanely large I wouldn’t spend a whole lot of time working on it unless you have already optimized the rest of your site and there’s nothing left to do (and even then it may not be worth it). Odds are that any improvement will not even be measurable.

I know it’s minor thing. But I want to do it anyway because it may cause a small improvement, it’s recommended and I get punished for it in my pagespeed scores… lol.

I just exported cookies to a .txt file with FireBug. I don’t know if this is the best way to measure it, but the file size was 2.11 kB. Is that large?

We already have the url for the external domain now. Which was probably less than $10/year so that’s not an issue at all.

Fair enough. Just make sure to do some testing to make sure the extra DNS lookup isn’t costing you more than the benefit you get from removing the cookies.

Dear Pat,

You have mentioned recently that for the DNS Lookup for a test with ‘DSL’ connection you have included an extra 50 ms delay.
Did you do that for the Initial Connection as well or is that (in all connection possibilities offered) the connection time without extra time added?

The reason why I am asking is because I am considering stopping to use the cookie-free domain for static content - so doing the opposit of Gnusmas’ intention.

Our cookis on have a size of ca. 900 Bytes (a bit less if not loged in, a bit more if logged in the watchlist).

Looking at this test result and considering that all current browsers handle (at least) 6 connections with the same hostname (according to ), I am thinking that the DNS Lookup + the Initial Connection of could cost more time than receiving a 900 Bytes cookie in the request of the client.

Currently I am loading static files from

Test examples:

What do you think?

Kind regards,

The 50ms is add round trip latency for all network round trips (at the packet level) so it’s not limited to DNS. The initial connection, request time and the ack’s while downloading content will all include the delay.

Looking at the connection view waterfall, hardly any content is served from the main domain (or the s. version) so you’re not going to see any improvement by moving the static requests to a different domain (unless that also happens to be a CDN).