Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying To "Cookie-Free" A Sub-domain Using .htaccess, But Doesn't Work

Yes, I have searched a lot, here and there, and this is the closest I've found that I thought could actually work. But it doesn't.

<IfModule mod_headers.c>
<FilesMatch "\\.(ico|x-icon|js|css|jpg|jpeg|png|gif|swf|pdf)$">
Header unset Cookie
Header unset Set-Cookie
Header unset ETag
FileETag None
</FilesMatch>
</IfModule>

Pretty clear it should be that I am trying to cookie-free the static files served by a sub-domain, and remove the ETag header on those static files. The ETag thing works fine, but I am unable to unset the cookies.

FYI, Wordpress is installed on example.com (NOT www.example.com; www.example.com redirects to example.com), which is not cookie-free. And i.example.com serves the static files. I want to make i.example.com cookie-free. Is it at all possible to make a subdomain cookie-free when the non-www tld is not cookie-free? (I also see that it's the reason why many suggest using www.tld).

like image 382
Aahan Avatar asked Nov 14 '22 17:11

Aahan


1 Answers

Why you remove the ETag for this files? I would suggest to set this:

FileETag MTime Size

so the browsers, proxies, etc. knows, if a cached file was changed or not.
This speeds up the site a little bit on further visits.

like image 181
Klaus Avatar answered Dec 04 '22 06:12

Klaus