how to use cookie-free domains in magento?

The question:

I analyzed my website on for optimization and the result was this:

There are 245 components that are not cookie-free:

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

  1. Configure another domain for skin and media
  2. check that the cookie domain is configured that way, that the cookies are not send along these domains
  3. Make sure, that you don’t get a problem with the JS due to “same origin policy”


  1. 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

  2. Make sure the cookie settings are so, that the cookie is NOT sent to the subdomain:

    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.

  3. 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 or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment