Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Google audit:

Serve static content from a cookieless domain (15) 2.65KB of cookies were sent with the following static resources. Serve these static resources from a domain that does not set cookies:

If my domain is widgets.com, should I set up a img.widgets.com that servers these resources? How beneficial is this?

Edit

I setup img.widgets.com to serve images from, and changed all images to this URL. But I still get that message?

share|improve this question
    
Regarding EDIT: I assume you do not specify any validity path for your cookies, so they match the main and subdomain by default. –  Itai Mar 5 '11 at 17:44
add comment

3 Answers

up vote 5 down vote accepted

Using img.widgets.com for cookieless requests won't work if your main pages are hosted on widgets.com (as opposed to a subdomain, like www.widgets.com). This is because the domain scope of a cookie is a domain and all subdomains, and so if the cookie's domain is widgets.com (necessary to get the cookie sent to widgets.com) then the cookie will also get sent in requests to img.widgets.com.

So, if your service is based on widgets.com cookies, you'd need to use a separate domain to host your cookieless items.

share|improve this answer
add comment

Each time someone request anything all cookies matching domain are sent. This adds weight to every request in proportion to how much cookies your site uses.

Since it seems your site relies heavily on cookies, you visitors should see a speed improvement if you serve images (and any static content, even css/js/etc) from a separate domain.

Google uses google.com and googlestatic.com which makes it easy to separate resources.

If you want to use subdomains (or paths) then you have to be more careful specifying your cookies' validity path.

share|improve this answer
add comment

The best reason for doing this that I can think of is for faster page loading. Since you can only download so much from one domain at a time, having your images on a separate domain allows you to load them just a little bit faster.

And from the note that google gives you, it also appears that your cookies may be impacting your image loading.

I've done this for really image heavy pages, but not for most normal pages, but if Google things its a good idea, it might be worth a try.

share|improve this answer
    
Thanks, my main concern is that a total of 3kb of cookie data has been uploaded to these images when my cookie size is about 50bytes, upload rate is the largest choker for users, so should I be working on hosting these on cookiless domains to improve load speeds? –  Tom Gullen Mar 5 '11 at 17:13
    
Yeah. I'd say it would probably be best to try to host on a cookieless domain. It would probably improve performance. –  lovefaithswing Mar 5 '11 at 19:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.