0

I'm trying to follow all the guidelines of "Google Page Speed​​". The directive "Minimize request overhead" requires static content (images, js, css, etc.) on a static server (ie cookieless): https://developers.google.com/speed/docs/best-practices/request

I do not want to buy a new server and I was thinking of just setting a directory of my site without cookie with htaccess

www.mysite.com/static/.htaccess

Header unset Cookie
Header unset Set-Cookie

I do not know if it can be problematic. Looking on google it seems that no one ever has adopted this type of solution, so I think that it is incorrect. What do you think?

alternatively you could do

www.mysite.com/.htaccess

<FilesMatch "\.(css|js|jpg|png|gif)$">
Header unset Cookie
Header unset Set-Cookie
</FilesMatch> 
Simone Nigro
  • 375
  • 2
  • 3
  • 17

1 Answers1

2

This doesn't help on a number of levels.

Cookie is a request header, not a response header. And by the time you can do anything about it, the client has wasted upstream bandwidth putting it on the wire.

You need to make the original Set-Cookie header has a path or domain that doesn't match your static assests domain/path.

covener
  • 1,685
  • 9
  • 15
  • As the cookies are also included on the response headers you actually save some bandwith by stripping them via .htaccess Not only the benefits or that are minimal, but they also come at the cost of wasting server resources so, yes, your efforts should be aimed at not writting cookis for static files in the first place. – NiloVelez Jul 29 '14 at 08:43