The question:
I analyzed my website on Gtmetrix.com for optimization and the result was this:
There are 245 components that are not cookie-free:
http://mysite.com/media/css/dabf35e7cd79eb387a68eed1d5f3f925.css
http://mysite.com/media/css/38f74ae13bf9722265996c2842cba8a5.css
http://mysite.com/media/js/b5de567c1b6b9d971394b4d4887370a1.js
http://mysite.com/skin/frontend/fortis/default/images/logo.png
http://mysite.com/media/wysiwyg/infortis/fortis/menu/custom/01.png
http://mysite.com/media/wysiwyg/infortis/fortis/menu/custom/02.png
http://mysite.com/media/wysiwyg/infortis/fortis/menu/custom/03.png
http://mysite.com/media/wysiwyg/infortis/fortis/slideshow/01.jpg
http://mysite.com/media/wysiwyg/infortis/fortis/slideshow/02.jpg
http://mysite.com/media/wysiwyg/infortis/fortis/slideshow/03.jpg
http://mysite.com/media/wysiwyg/infortis/fortis/slideshow/04.jpg
http://mysite.com/media/wysiwyg/infortis/fortis/slideshow/banner/01.png
http://mysite.com/media/wysiwyg/infortis/fortis/slideshow/banner/02.png
http://mysite.com/media/wysiwyg/infortis/fortis/slideshow/banner/03.png
http://mysite.com/media/wysiwyg/infortis/fortis/icons/large/paintbrush.png
http://mysite.com/media/wysiwyg/infortis/fortis/icons/large/responsive.png
http://mysite.com/media/wysiwyg/infortis/fortis/icons/large/menu.png
http://mysite.com/media/wysiwyg/infortis/fortis/custom/banners/03.png
http://mysite.com/media/wysiwyg/infortis/fortis/custom/banners/11.png
.
.
.
Serve static content from a different domain to avoid unnecessary
cookie traffic.
how to solve this?
The Solutions:
Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.
Method 1
- Configure another domain for skin and media
- check that the cookie domain is configured that way, that the cookies are not send along these domains
- Make sure, that you don’t get a problem with the JS due to “same origin policy”
UPDATE
-
set the media, skin and js url to your new domain:
System > Config > Web > Unsecure/Secure > Base Media URL
System > Config > Web > Unsecure/Secure > Base Skin URL
System > Config > Web > Unsecure/Secure > Base JavaScript URL
-
Make sure the cookie settings are so, that the cookie is NOT sent to the subdomain: https://stackoverflow.com/a/23086139
I assume this is the case if you DON’T set the domain – but maybe Magento is change this, so it sets the domain itself. If this is the case, you would either hack magento or use a www. subdomain for your shop.
-
Make sure your JS still works and doesn’t throw errors due to Same-Origin-Policy. If this is the case, your JS doesn’t work and you see the errors in your browsers console.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0