In an observer I'm setting a cookie like this:
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$cookieManager = $objectManager->get('Magento\Framework\Stdlib\CookieManagerInterface');
$cookieManager->setPublicCookie('myvar', $myVar);
Everything is working when Full page caching
is disabled. However, once I enable it, the cookie won't be set.
How can I fix this?