Magento – Enable Cookies to continue

cookiemagento-1.8

I have just installed Magento 1.8, when I login it shows me this message:

Please enable cookies in your web browser to continue.

I have enabled cookies. I am using Chrome. What do I need to do?

Best Answer

You are seeing the enable-cookies CMS page, which is shown if the event controller_action_nocookies is triggered. This happens in Mage_Core_Controller_Varien_Action if:

  1. The configuration Web > Browser Capabilities Detection > Redirect to CMS-page if Cookies are Disabled is set to Yes, AND
  2. No cookie has been sent back by the browser yet (i.e. $_COOKIE is empty) AND
  3. The current controller action is in the $_cookieCheckActions property of the controller and there is no nocookie=1 parameter.

Logging in and creating an account are controller actions, that require a cookie check, as you can see in Mage_Customer_AccountController:

/**
 * Action list where need check enabled cookie
 *
 * @var array
 */
protected $_cookieCheckActions = array('loginPost', 'createpost');

You could disable the cookie check configuration (see (1)), but this won't solve the problem because without a session cookie you won't be able to log in anyway.

The problem lies in Magentos cookie management configuration. Please check it at Web > Session Cookie Management. It should look similar to this:

config screenshot

  • "Cookie Lifetime": a sufficiently big value in seconds
  • "Cookie Path": the path to your Magento installation relative to the document root (usually /)
  • "Cookie Domain": the domain of your Magento installation, including www subdomain if used.
  • "Use HTTP Only" can be set to "Yes" as long as you don't need to access cookies with JavaScript. I usually set it to "No" to be able to run Selenium tests.
  • "Cookie Restriction Mode" should be "No", except if you are legally required to have your users allow cookies with a button click (like in France)