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); $this->_storeManagerInterface->getStore()->setCurrentCurrencyCode($currency);
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?