serving static file from cookieless domain: alternative cookieless directory

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> 

Answer

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.

Attribution
Source : Link , Question Author : Simone Nigro , Answer Author : covener

Leave a Comment