Current time: 12-15-2017, 03:09 AM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Serving static content from a cookieless domain
12-22-2009, 01:53 AM (This post was last modified: 12-22-2009 02:24 AM by Naresh.)
Post: #1
Serving static content from a cookieless domain
I have two questions, could be silly though Smile

1. Instead of serving static content from a cookieless domain, can we serve static content from a sub-domain?
2. And how to configure it as a cookieless sub-domain or domain ( if sub domain is really not possible)?

Just an additional information that we are using our domain as http://www.example.com ( not as example.com).

Thanks in anticipation.
Find all posts by this user
Quote this message in a reply
12-22-2009, 07:28 AM
Post: #2
RE: Serving static content from a cookieless domain
1 - You could serve the content from a different sub-domain but if you set any cookies to the top domain it would defeat the purpose.

For example...If your website is at http://www.example.com you could serve static content from images.example.com as long as you never set cookies to example.com (and set them to http://www.example.com instead).

2 - There's really no explicit concept of a "cookieless domain" it is just by convention that you NEVER set cookies on that domain from your pages.
Visit this user's website Find all posts by this user
Quote this message in a reply
12-23-2009, 03:30 AM
Post: #3
RE: Serving static content from a cookieless domain
Pat,
Thanks very much for your valuable input. We are serving our static content from sub domain/s and having cookies set up at the domain level ( http://www.example.com). We do need cookies at domain level and can't get rid of these.

I was going through this blog http://www.pubbs.net/nginx/200909/84064/ where in first paragraph Nick mentioned that it is possible to have cookieless sub domain in such situations, but didn't mention how? and there is no link to ask him a question either. Wondering is there real way to this or it was just a guess Smile
Find all posts by this user
Quote this message in a reply
12-28-2009, 04:22 PM
Post: #4
RE: Serving static content from a cookieless domain
to make sub domain cookie less see this discussion http://blog.wasimasif.com/serving-images...ss-domain/

If you must share cookies for all sub domains you should use completely separate domain to serve static content. For example your domain is http://www.mydomain.com and all images on the page can be served from http://www.myimagedomain.com. For example face book logo is being served from http://static.ak.fbcdn.net/

http://www.sphinxconsultant.com/performance-scalability-services/
Visit this user's website Find all posts by this user
Quote this message in a reply
12-30-2009, 02:49 AM (This post was last modified: 12-30-2009 02:49 AM by Naresh.)
Post: #5
RE: Serving static content from a cookieless domain
Thanks wasimasif. This was great. I found another link in comments section of your blog, how to create cookieless sub domain. I 'll try that and will keep you guys posted. The link was http://www.kensfi.com/serve-static-conte...ss-domain/
Thanks.
Naresh
Find all posts by this user
Quote this message in a reply
12-31-2009, 04:41 AM
Post: #6
RE: Serving static content from a cookieless domain
I think I got the answer from Yahoo http://developer.yahoo.com/performance/rules.html link It says :

Use Cookie-free Domains for Components

tag: cookie

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 http://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 http://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 http://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.
Find all posts by this user
Quote this message in a reply
01-24-2010, 01:42 AM
Post: #7
RE: Serving static content from a cookieless domain
Hi everyone, just discovered this amazing site! Really well thought out & put together.

I ran a test on my site & saw that I need to Enable browser caching of static assets. Searching to find out more I found this thread instead. It seems really interesting.

Do I understand this correctly?... When images are downloaded cookies get downloaded with them too? So if I put my images on a separate domain which does not use cookies I will get a faster response time? That would also apply to style sheets etc?

Sorry if this is a real newbie kind of question.

-
Find all posts by this user
Quote this message in a reply
01-24-2010, 03:24 AM
Post: #8
RE: Serving static content from a cookieless domain
Sort of. When images or style sheets are requested, the request includes any cookies for the domain. It doesn't usually make a HUGE difference but sending the cookies up to the server takes time (more so than downloading since the upload bandwidth is usually quite a bit less than the download bandwidth). Putting the static content on a different domain keeps the requests clear of cookies and makes them a bit faster.

The cookies (and ETags) are the least important of the optimizations though and at best will save a few milliseconds. Making the static assets cachable can have an ENORMOUS difference for a repeat visit (50-90% faster).
Visit this user's website Find all posts by this user
Quote this message in a reply
09-23-2010, 05:39 AM
Post: #9
RE: Serving static content from a cookieless domain
Using another domain to serve static content also speeds up the rendering by getting around the concurrent-connections to each domain rule in the browsers.

If you're using a sub-domain of the main domain chances are this will not help with cookies. In the case of your main content being on example.com and then using the sub-domain static.example.com cookies will generally be set for .example.com and thus be sent with requests to static.example.time. This is particularly true with Google AdSense which doesn't allow you to limit the domain the cookie is set for.

I wrote an article about this subject, including speed tests with Chrome and Keynote for the before and after: http://symkat.com/105/cookieless-domains/

I hope this is helpful. Heart
Find all posts by this user
Quote this message in a reply
01-08-2011, 07:52 AM
Post: #10
RE: Serving static content from a cookieless domain
Hello,

we have the same problem. We write a new Domaincheck and images are really slow http://www.internex.at/de/domain/domain-check.php

Should we use a second domain for images?

thanks
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)