Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

What is a cookie-free domain? I've seen these words many times but I never understood what it is.

share|improve this question

migrated from stackoverflow.com Oct 26 '09 at 4:54

This question came from our site for professional and enthusiast programmers.

add comment

2 Answers 2

up vote 11 down vote accepted

A domain that serves no cookies. The idea here is that you use a cookie-free domain to serve images, CSS files, scripts and whatnot, so that your users don't waste time and bandwidth transmitting cookies for them. SO uses sstatic.net for the purpose, for example.

The main reason the concept is of any note is that most people can't use a subdomain of their main domain to do this (like SO couldn't use static.stackoverflow.com) because they serve cookies that are valid across the entire second-level domain.

share|improve this answer
3  
Also, some proxies won't cache a request that includes cookies, so a cookie-free domain can improve cacheability and save you more bandwidth than just cutting out the size of the cookies themselves. –  stevemegson Oct 24 '09 at 20:35
1  
The cookies are that much huge enemy of bandwidth ? –  Tarik Oct 25 '09 at 4:58
add comment

When the browser makes a request for a static image and sends cookies together with the request, the server doesn't have any use for those cookies. So they only create network traffic for no good reason. You should make sure static components are requested with cookie-free requests. Create a subdomain and host all your static components there.

If your domain is www.example.org, you can host your static components on static.example.org. However, if you've already set cookies on the top-level domain example.org as opposed to www.example.org, then all the requests to static.example.org will include those cookies. In this case, you can buy a whole new domain, host your static components there, and keep this domain cookie-free. Yahoo! uses yimg.com, YouTube uses ytimg.com, Amazon uses images-amazon.com and so on.

Another benefit of hosting static components on a cookie-free domain is that some proxies might refuse to cache the components that are requested with cookies. On a related note, if you wonder if you should use example.org or www.example.org for your home page, consider the cookie impact. Omitting www leaves you no choice but to write cookies to *.example.org, so for performance reasons it's best to use the www subdomain and write the cookies to that subdomain

source: http://developer.yahoo.com/performance/rules.html

share|improve this answer
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.