performancecookiespagespeedyslow

Use cookie-free domains in Opencart - YSlow recommendation


I'm trying to optimize my website speed according to Google Speed Test and GTMetrix YSlow. One of the recommendation is to "use cookie-free domains", there are 12 components that are not cookie-free.

The 12 components are images and some CSS and JS files.

What is the problem and how to fix it?


Solution

  • Cookie free domains relates to having domains that send a cookie with every request.

    Say for example you serve all of your images from your main domain and your main domain has cookies on it.

    Every one of those images will have a cookie sent with the request for the file, which the server ignores anyway.

    This is completely unnecessary traffic as the cookie serves no purpose.

    To fix this either use a cookie free CDN or set up a sub domain on your server that has no cookies.

    Then serve all of your static assets such as fonts, images, JS and CSS from this sub domain / CDN.