I'm having a problem with the currency and the cache. I'm using Magento ver. 2.2.5 with Redis and Varnish.

Here are the steps to reproduce...

  1. Go to homepage
  2. Go to some PLP
  3. Change the currency
  4. Go to the homepage again (by clicking the logo)

Spected result:

The currency must be the selected one in the step 3

Actual result:

The currency is the same than step 1

Note: When I go to the home page by clicking the logo, the issue happens. But if I press F5 it works fine.

Then, I try to find the difference between clicking the logo and made an F5 refresh. I can see a difference in the request. When I click the logo I can see this request header.

enter image description here

But when I do an F5 refresh I can see this request header.

enter image description here

I can solve this by adding this header on the server response.

$resultPage->setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0', true);

But I think that's wrong. I mean, I'm disabling cache right?.

If somebody have an idea it will be appreciated! Thanks

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.