Domanda

My store is multi domain and every domain has a different default currency: - .com -> USD - .eu -> EUR

The store has EE FPC enabled on Redis backend.

The issue:
Sometime product pages of the store .com get cached with a wrong currency. ( if I clean FPC then the page/currency it is ok )

Now FPC stores the key using the request and cookies ( so also the currency in case the user changed it) thus the key should be unique for every url/currency request.
Anyway It looks like in some cases, request to product page X on the Domain A override the cached page for the Domain B.

I cannot figure out what is the reason because this is happening on random basis and It is hard to reproduce.

What can I check ? any idea to debug this is very welcome

È stato utile?

Soluzione

I finally found the cause of this issue and I think I can say it is a kind of bug on FPC or maybe better on the Store Object.

The main problem is the FPC relay on COOKIE to check the currency and create the request ID, this is not consistent and can break the cache in some weird situation.

To reproduce:

  1. Access to a product page
  2. Switch to another currency ( anyone different from the default)
  3. Delete the currency cookie
  4. Clean the FPC cache
  5. Access again the page

From this moment on the page is cached with a different currency from the default one ( try to open the page with in incognito mode ). This is bad because potentially a use can alter the cache behavior.

Note It can happen also that the store switcher is showing one currency and the other blocks are showing another one ( depending what kind of blocks you have on the page and the cache policy associate with them )

Code Details
Mage_Enterprise_PageCache_Model_Processor::_createRequestIds()

....
  if (isset($_COOKIE['currency'])) {
      $uri = $uri . '_' . $_COOKIE['currency'];
  }
....

The Store Switcher get the current currency use the session: Mage_Core_Model_Store::getCurrentCurrencyCode()

 public function getCurrentCurrencyCode()
    {
        // try to get currently set code among allowed
        $code = $this->_getSession()->getCurrencyCode();
...

Why this is happening so often on my store

I have altered the code for sessions in order to fix a problem with the various crawler bot creating thousand of session on my store. (see Magento generating aprox 20 session files per minute )

The modification done is fine but conflict with the above cache behavior ( because Crawler do not preserver cookies )

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a magento.stackexchange
scroll top