Page Speed's "Serve Static Content From a Cookieless Domain"

6 views
Skip to first unread message

Seffo

unread,
Nov 29, 2010, 1:28:09 PM11/29/10
to page-speed-discuss
It's probably my lack of formal training, but am I misinterpreting
something?

Page Speed scores me negatively on serving static content from a
cookieless domain and then lists all my images, but when I check the
resources page and look at the headers for all of these images, they
are being served without a Cookie according to Page Speed?

What's even more confusing to me is that even the images that I
elected to leave on the primary domain are being reported as having no
Cookie in the headers?

It is probably something to do with the way I have set up the DNS as
it is this area of WWW that confuses me a tad. In testing I am serving
images from 3 different areas at present to see if I can get a better
score and have set up the DNS as follows

Our primary domain is fitzgroup.com.au which points to our server # 1.
images.fitzgroup.com.au also points to this server and is a C-Name of
fitzgroup.com.au
image.fitzgroup.com.au however points to Server # 2 and is an A-Name
of fitzgroup.com.au

I can only assume Page Speed is penalising me because I haven't
actually registered a totally new domain to serve these resources?

Can anyone shed any light on whether my assumption is correct, or pont
me in the right direction please?

Alex McAuley

unread,
Nov 29, 2010, 2:48:18 PM11/29/10
to page-spee...@googlegroups.com
The domain that is serving them has set a cookie in the past for said
images.


Alex Mcauley
www.theukjobsite.co.uk

> --
> You received this message because you are subscribed to the Google Groups
> "page-speed-discuss" group.
> To post to this group, send email to page-spee...@googlegroups.com.
> To unsubscribe from this group, send email to
> page-speed-disc...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/page-speed-discuss?hl=en.
>
>

Bryan McQuade

unread,
Nov 29, 2010, 4:33:40 PM11/29/10
to page-spee...@googlegroups.com
Page Speed looks at what cookies the browser would advertise for the
given URL, not just the request/response headers.

You can look at which cookies apply to a given resource in Firefox by
opening "Preferences" and choosing the "Privacy" tab. There is an
option to "remove individual cookies" (might be called something else
in other versions of FF) that lets you see which cookies are
associated with each hostname.

Note that a cookie set on foo.com will be applied to all subdomains of foo.com.

So in your case if any cookies are applied to fitzgroup.com.au they
will also be applied to image(s).fitzgroup.com.au.

Seffo

unread,
Nov 29, 2010, 5:20:32 PM11/29/10
to page-speed-discuss
Thanks Bryan

So my assumption is sort of correct in that because I haven't
registered a separate and distinct domain, the images are being
treated as if they are served from the primary domain by nature of the
commonality of the domain name itself and irrespective of whether they
are served from different servers, IP Addresses or indeed separately
configured websites?

Bummer... seems a weakness in the manner in which the "speed score" is
calculated. To get the best result one must register multiple domain
names even if in fact the images themselves do not set cookies if
called directly by typing in the appropriate URL, e.g. if one calls
http://images.fitzgroup.com.au, there are no cookies set by the test
page I have set up there because that is how I have set up that
Website... no cookies. Or, do I assume the primary domain's cookie is
modified by each resource any of it's pages call up because the actual
domain name is common?

Am I missing something, because if that isn't how the cookies work,
then why the speed score penalty?

Jonathan Klein

unread,
Nov 29, 2010, 5:42:44 PM11/29/10
to page-spee...@googlegroups.com
Hello,

You might want to install Live HTTP Headers (a Firefox addon) and look at the requests for your images - you can also do this in the Firebug net panel.  When you do this you will see that every image request includes cookies in the request headers.  The fact that your images are on a separate subdomain/server/IP is actually irrelevant at this point, like Bryan said any cookies set on fitzgroup.com.au will be applied to all sub domains, which means that the browser will include all cookies for the domain on every request to images.fitzgroup.com.au.  Even though the images don't have any cookies associated with them the client still has to send the cookie data over the wire on every request because the images are hosted on a sub domain of fitzgroup.com.au

If you clear all of your cookies and surf to an image directly you won't see any cookies in the request, because none have been set on the parent domain yet.  But if you navigate to your homepage you will see that any cookies you set on fitzgroup.com.au are also sent with the requests for your images.  See more information here:

http://code.google.com/speed/page-speed/docs/request.html#ServeFromCookielessDomain
http://developer.yahoo.com/performance/rules.html#cookie_free

As the Yahoo! post mentions, if you explicitly set the cookies on www.fitzgroup.com.au and then force people to remain on www. when they surf your site you will be able to use your cookie free image sub domain, otherwise you will need to create a new domain for static content if you want to avoid transmitting cookies back and forth with these requests.

Let us know if you have any other questions about this. 

-Jonathan




--

Seffo

unread,
Nov 29, 2010, 11:14:23 PM11/29/10
to page-speed-discuss
I thought I sent this reply once (well ine very similar, I can't
remember exactly how I phrased it last time), but it isn't appearing
in the group so my apologies if this suddenly appears twice or if I
sent it directly to you Jonathon instead...

I have removed the fitzgroup.com.au listing from my the multiple
identities section of my IIS 5 setup leaving just the www.fitzgroip.com.au
entry but it still serves cookies in the name of fitzgroup.com.au..
unless this is a cache issue does this mean I need to change my DNS?

... yes I am clearing the fitzgroup cookies before I test... and yes I
stopped and restarted web services after the change...

OR, do I really need to purchase a separate domain name?

Seffo

unread,
Nov 29, 2010, 10:31:04 PM11/29/10
to page-speed-discuss
Hi

I attempted to force people to keep on the www.fitzgroup.com.au domain
by removing the fitzgroup.com.au listing from the multiple identity
section of my IIS 5 domain setup and just leaving the www.fitzgroup.com.au
entry, but the cookies are still being set to fitzgroup.com.au... is
this what you meant or do I have to change my original delegation
somehow?

Alternatively if what I have done is the correct solution then there
must a cache issue or something... and yes... I am remembering to
clear my fitzgroup cookies before each test I attempt.

Sorry to be such a pain... I really don't understand DNS bit very well
so if I do need to change DNS I have no idea what I need to do...
maybe I really do need to register a new domain?

Seffo

Seffo

unread,
Nov 29, 2010, 10:27:48 PM11/29/10
to page-speed-discuss

Alex McAuley

unread,
Nov 30, 2010, 9:12:18 AM11/30/10
to page-spee...@googlegroups.com
The Easiest way to do it is to trick the page speed tool into thinking it's
from a different box

I did this by creating a CDN on my domain that just sent the js / css /
images but no cookies.

This also allowed me to do more parallel downloads and thus render the page
faster.

To do this for yourself follow these steps.

1. Create a DNS entry for cdn.yourhostname.com
2. adjust your pages / css / paths to read from
cdn.yourhostname.com/the/path/to/the/resource....
3. Clear all cookies from yourdomain.com
4. when setting cookies from your domain (or how I got caught out from
google analytics) only set cookies with the domain www.yourdomain.com
5. re-run the page speed tool.

hope this helps

Alex Mcauley
http://www.theukjobsite.co.uk

----- Original Message -----
From: "Seffo" <j...@fitzgroup.com.au>
To: "page-speed-discuss" <page-spee...@googlegroups.com>
Sent: Tuesday, November 30, 2010 3:27 AM
Subject: [page-speed-discuss] Re: Page Speed's "Serve Static Content From a
Cookieless Domain"

Sam Kerner

unread,
Nov 30, 2010, 10:07:29 AM11/30/10
to page-spee...@googlegroups.com
On Tue, Nov 30, 2010 at 9:12 AM, Alex McAuley
<webm...@thecarmarketplace.com> wrote:
> The Easiest way to do it is to trick the page speed tool into thinking it's
> from a different box

Alex,
I don't think "trick" is the right word here. Cookies are defined
to bind to host names, and this is one very good reason.

If one computer has two host names pointing to it, then it has two
different namespaces for cookies. This was a deliberate design
decision. It allows you to only send cookies when you need them, even
if you have one physical machine serving many domains. If cookies
were bound to an IP address instead, Page Speed would have to
recommend that you buy more servers (or at least more network cards).

Sam

Alex McAuley

unread,
Dec 1, 2010, 3:42:04 AM12/1/10
to page-spee...@googlegroups.com
Sam.

Cookies bind to full hostnames and they should be set to
subdomain.thedomain.com rather than .thedomain.com

Your point disagrees then agrees with mine so I can't really see the point
in it to be honest.

The user asked how to get around the cookie problem and I explained how to
do it without buying a CDN and increasing page speed by parallelising
downloads

Regards

Alex
http://www.theukjobsite.co.uk


----- Original Message -----
From: "Sam Kerner" <ske...@google.com>
To: <page-spee...@googlegroups.com>
Sent: Tuesday, November 30, 2010 3:07 PM
Subject: Re: [page-speed-discuss] Re: Page Speed's "Serve Static Content
From a Cookieless Domain"

Sam Kerner

unread,
Dec 1, 2010, 10:08:39 AM12/1/10
to page-spee...@googlegroups.com
On Wed, Dec 1, 2010 at 3:42 AM, Alex McAuley
<webm...@thecarmarketplace.com> wrote:
> Sam.
>
> Cookies bind to full hostnames and they should be set to
> subdomain.thedomain.com rather than .thedomain.com
>
> Your point disagrees then agrees with mine so I can't really see the point
> in it to be honest.

My point is that Page Speed is doing what browsers do. When you say:

> trick the page speed tool into thinking it's from a different box

a reader might infer from "trick" that you are deceiving page speed
without really solving the problem. Because browsers are tricked in
the exact same way, this is not the case.

> The user asked how to get around the cookie problem and I explained how to
> do it without buying a CDN and increasing page speed by parallelising
> downloads

It is clear from your message that you are an expert who understand
this. I understand what you meant, and I agree with it I replied to
your message because I can see someone who is trying to learn reading
that first sentence and thinking you meant something else.

Sam

Alex McAuley

unread,
Dec 1, 2010, 10:56:58 AM12/1/10
to page-spee...@googlegroups.com
Ah ok Sam.

I can't really think of a differnet word than trick - but if you can please
let me know.

Kind regards

Alex Mcauley
http://www.theukjobsite.co.uk

Seffo

unread,
Dec 1, 2010, 6:05:34 PM12/1/10
to page-speed-discuss
Hi All

Thanks for all the input... I gave up trying and registered another
domain from which I will serve all static content for all the sites we
host... relatively cheap considering how much time I had already spent
trying to get it to work... everything is woking as I was hoping for
now.

Thanks again
Seffo

On Dec 2, 2:56 am, "Alex McAuley" <webmas...@thecarmarketplace.com>
wrote:
> Ah ok Sam.
>
> I can't really think of a differnet word than trick - but if you can please
> let me know.
>
> Kind regards
>
> Alex Mcauleyhttp://www.theukjobsite.co.uk
> > ----- Original Message ----- From: "Sam Kerner" <sker...@google.com>

Alex McAuley

unread,
Dec 2, 2010, 9:30:59 AM12/2/10
to page-spee...@googlegroups.com
You don't need another domain - just setup a subdomain on your current
domain!.

If you host charges you for setting that up then they should be shot!.

It doesnt need any other hosting as the docroot for it should be set to the
same as your site.

Alex Mcauley

Seffo

unread,
Dec 2, 2010, 1:47:52 PM12/2/10
to page-speed-discuss
I tried a number of variations of using a sub-domain, but no matter
how I tried it kept linking all the subdomain variations to my
original domain - cookiewise that is... and as I said, I have already
bought the new domain... as for being charged for hosting of the new
domain... that won't happen... we do our own hosting too... just
seemed simpler in the long haul.

Thanks again

Seffo


On Dec 3, 1:30 am, "Alex McAuley" <webmas...@thecarmarketplace.com>

Paul

unread,
Dec 3, 2010, 4:08:42 AM12/3/10
to page-speed-discuss
Hi Alex, I also tried various subdomains without luck, I think it
keeps looking at the main domain which is a cookied domain.

On Dec 2, 2:30 pm, "Alex McAuley" <webmas...@thecarmarketplace.com>
wrote:

Alex McAuley

unread,
Dec 4, 2010, 4:37:42 AM12/4/10
to page-spee...@googlegroups.com
That's why you have to clear the cookies on the main domain.

If you are running google analytics you must then set the analytics to the
www.domain.com rather than it's default (as analytics sets a cookie for
*.domain.com) - then run the test again.

You only need to do that lot once!

I had exactly the same issue and I solved it by doing the above

HTH

Alex Mcauley
www.theukjobsite.co.uk

Seffo

unread,
Dec 8, 2010, 2:26:05 PM12/8/10
to page-speed-discuss
Hey Alex

So I can blame Google for my new domain!

I never ever noticed Analytics set the default to http://fitzgroup.com.au
I just assumed it would set it to the full path I had enetered when
setting it up... i.e. http://www.fitzgroup.com.au I never bothered to
look at the actual configuration, I bet this was my issue... as it
turned out the 4 sites I was working on at the time were all using
Analytics as well...

A belated thanks if this is all it was, I'll set up one of my other
sites with this in mind (non-analyticced - if that's a real word?) and
see if it was the issue in my case then I might consider converting
the sites back to how I originally wanted them. My shortcut of buying
the new domain was going to give me additional issues with two of my
sites that are going https very soon and I would have either needed to
serve static components from the original domain for the https pages
OR receive the pop up "some items on this site are unsecure .... " OR
purchase 2 SSL's for each site.

Seffo

On Dec 4, 8:37 pm, "Alex McAuley" <webmas...@thecarmarketplace.com>
wrote:
> That's why you have to clear the cookies on the main domain.
>
> If you are running google analytics you must then set the analytics to thewww.domain.comrather than it's default (as analytics sets a cookie for

Alex McAuley

unread,
Dec 9, 2010, 9:22:45 AM12/9/10
to page-spee...@googlegroups.com
Seffo.

https is a pain because wildcard certs are so dang expensive.

If you are looking to get your page speed up to help your rankings then you
can optimize all of the non https pages and put a robots.txt in for the
https ones!

With regards to the analytics - if you load them async you can specify the
domain like so...


var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'XX-XXXX-X']);
_gaq.push(['_setDomainName', 'www.domain.com']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' :
'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();

Message has been deleted
Message has been deleted

Juraj R

unread,
Dec 10, 2010, 4:08:13 AM12/10/10
to page-speed-discuss
Seffo,

Alex is true: add _gaq.push(['_setDomainName', 'www.domain.com'])
But cookies are the last problem you need to fix!

You have 282 images (8305.6K)!!!! Crazy much! And all without
parallelization!
Check this: http://www.webpagetest.org/result/101210_2HZ6/ (my
resoults: http://www.webpagetest.org/result/101025_96C0/ and
http://www.webpagetest.org/result/101019_8EJE/ )
its not waterfall its "salto angel"! If you really need 282 images on
page, split it to subdomains: images1.fitzgroup.com,
images2.fitzgroup.com ... images5.fitzgroup.com !!! Then you will
change "Salto Angel" to "Niagara Falls" :-)

2nd your expiration time is 4hous (its to short) 1 year is OK
3rd optimize images: YSlow - Tools - All Smush.it (its really easy to
do it). You can save: Smushed 28.74% or 2361.93 KB from the size of
your image(s).

Other thing like minify CSS (javascript), are also easy to do, but in
your case its just small speedup. Main problem are images.

Good luck
Juraj Repcik
www.techwood.sk (also trusses:-)
Message has been deleted

Seffo

unread,
Dec 10, 2010, 2:32:48 PM12/10/10
to page-speed-discuss
Hi

Juraj

You have doe a lot of testing and I thank you for your efforts on my
behalf, however... you have the wrong website. Your testing was done
on www.fitzgroup.com, but my site is www.fitzgroup.com.au.

Alex
I tried out the changes you suggest and so far so good... so long as
analytics still works properly then you have solved at least part of
my problem... many thanks. As you say wild card SSLs are expensive so
I am still equivocating as to whether to do that or just serve the
https page(s) from a single domain and forego the poor speed ranking
on those pages.

Thanks again everyone

Seffo

On Dec 10, 8:17 pm, Juraj R <repcikju...@gmail.com> wrote:
> Seffo,
>
> Alex is true: add _gaq.push(['_setDomainName', 'www.domain.com'])
> But cookies are the last problem you need to fix!
>
> You have 282 images (8305.6K)!!!!  Crazy much! And all without
> parallelization!
> Check this:http://www.webpagetest.org/result/101210_2HZ6/  (my
> results:http://www.webpagetest.org/result/101025_96C0/andhttp://www.webpagetest.org/result/101019_8EJE/)
> its not waterfall its "salto angel"! If you really need 282 images on
> page, split it to subdomains: images1.fitzgroup.com,
> images2.fitzgroup.com ... images5.fitzgroup.com !!! Then you will
> change "Salto Angel" to "Niagara Falls" :-)
>
> 2nd your expiration time is 4hous (its to short) 1 year is OK
> 3rd optimize images: YSlow - Tools - All Smush.it (its really easy to
> do it).  You can save: Smushed 28.74% or 2361.93 KB from the size of
> your image(s).
>
> Other thing like minify CSS (javascript), are also easy to do, but in
> your case its just small speedup. Main problem are images.
>
> Good luck
> Juraj Repcikhttp://www.techwood.skhttp://www.anatomic.sk

Juraj R

unread,
Dec 11, 2010, 8:39:54 AM12/11/10
to page-speed-discuss
Sorry Seffo,
is a big difference between these sites:-)
Juraj


Reply all
Reply to author
Forward
0 new messages