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

1 Answer 1


Finaly, the problem was that the Varnish configuration was letting the browser cach the non-static files throug the Cache-Control header.

So the FPC pages let cached in the browser.

Adding this configuration to the Varnish configuration (vcl), the problem was solved.

Not letting browser to cache non-static files.

if (resp.http.Cache-Control !~ "private" && req.url !~ "^/(pub/)(media|static)/") {
      set resp.http.Pragma = "no-cache";
      set resp.http.Expires = "-1";
      set resp.http.Cache-Control = "no-store, no-cache, must-revalidate, max-age=0";

PD: Varnish 5

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.