I created my module for GeoIP where I get location based on IP and set currency and stores according to It.

I have implemented the login in the first possible observer controller_action_predispatch to initiate this logic.

$currentIp = $this->_remoteAddress->getRemoteAddress();
$currency = $this->getCurrency($currentIp);

The above implementation is just an sample of what I am doing and it works great.

However when implementing varnish in my server my logic fails. Now My question is I dint find any solution to make observer cacheable false as cacheable false works for blocks I guess. Even though I may get a solution to make it cacheable false will varnish implantation be logical as my observer will be called every time and I will get my page as miss.

What can I do to overcome this?

  • Are you using cookie? Sep 9, 2017 at 5:31
  • @padhiyar gaurang Yes
    – Priyank
    Sep 9, 2017 at 5:32
  • ohh!!! sometimes varnish is to unpredetable with cookie. It is due that or see my answer below. It may can help. Sep 9, 2017 at 5:33

1 Answer 1


Please refere to this


Geo IP based store view selection with Varnish

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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