Where did those cookies come from?

(thread migrated from sourceforge forum - originally posted 7/4/2008)

Hi, great tool guys.

I’ve tweaked my site to death in order to learn the optimisation techniques you encourage.
With your help I’m getting quite good too, thanks.

site: http://websemantics.co.uk/
results: http://www.webpagetest.org/result/41K/

I’ve an issue with static object cookies.
I think by switching off E-tags I’ve caused these to appear.

Could you tell me what is the likely cause and how to get rid of them?


mike foskett

Damn it, it’s the php session that’s the cause.
I’m using a session variable to swich on/off ajax components.
But why is it adding cookies to absolutely everything?

Any ideas on preenting this happening?



Can you post a link to your test results or just the url you are testing? Odds are that the cookie is being set to the base domain for your page and because of that it gets sent for all of the static requests as well. The easiest way around it is to use a CNAME on a completely different domain to host the static content.

For example:

http://www.mypage.com would be the main page with the cookie being set to either mypage.com or http://www.mypage.com

Creating a CNAME http://www.mypagestatic.com and ensuring that only static content is served from there would ensure that no cookies get sent with static content. Depending on how much static content you have, using different domains for the static content will alos let the browser make more parallel requests (www1 and www2 for example).

You could also just use static.mypage.com but you’d have to be careful and make sure that the cookies are set explicitly to http://www.mypage.com and not the tld.


Doh, sorry, read the response and not your original message that had the urls in it :slight_smile:

Looks like the cookie is being set to the tld since you’re serving the base page from websemantics.co.uk. You can either make the base page something like http://www.websemantics.co.uk and attach the cookie to that (though it would suck to have to introduce a redirect) or instead of using graphics.websemantics.co.uk use websemanticsgraphics.co.uk to serve your static content.


Thanks for the input Pat,

You are right the cookies were added to the tld.
I’ve accessed all files via a different domain while I try to find out what causes a php session cookie to go overboard like that.
Any ideas?

This is a great tool and I cannot believe that your servers aren’t constanly hammered with requests.
Though I’m grateful.
One suggestion would be to make it easier for users (me) to access historic records.
The current method is a tad longwinded.

Once again cheers for the support dude.


I’m pretty sure the php cookie is being set to the tld because that’s where you’re serving the actual pages from. If your pages were on http://www.websemantics.co.uk then the cookies could be set on a more specific domain but the way you have it set up is probably better (the extra redirect would hurt more than the benefit you get from putting the cookies on a more specific sub-domain).

At some point I hope to put an actual database behind the system so it’ll be easier to see your old tests. In the meantime since the urls are permanent you can keep track of your tests on a wiki somewhere and put notes in about what changes you made for each one.


Thank you for share information and link. My view for different.
Also Known As Tracking Cookies
can come from ANY Website
with adverts
You find adverts usually on top of websites
Tracking cookies aren’t that dangerous each tracking cookies slows down your internet a small bit(i mean extremely small)
As they are saved onto your computer and when you load pages
all your tracking cookies are scanned when you try to enter a page
and they aren’t dangerous AT ALL.
when you load a website
on your browser(firefox preferably) look at the bottom left corner
it will say stuff like ad.url.com
They are when tracking cookies are sent to your computer
Im afraid tracking cookies are everywhere and its good to scan your computer daily for them.
They are usually known as Unwanted Stuff on anti virus programmes

Yeah, given the impact of most of the other problems, cookies tends to be almost insignificant for performance. Most ads and things won’t set cookies on your domaiin though unless they were actually served directly by you.

Thanks share this information with us. CCleaner is a free ware system optimization and privacy tool. It removes unused files from your system - allowing Windows to run faster and freeing up valuable hard disk space. It also cleans traces of your online activities such as your Internet history. But the best part is that it’s fast (normally taking less than a second to run) and contains NO Spyware or Adware! :