docker-magento2 icon indicating copy to clipboard operation
docker-magento2 copied to clipboard

Magento not being set to use Varnish

Open dunagan5887 opened this issue 7 years ago • 4 comments

Given this Magento-Varnish setup, Magento isn't actually aware of Varnish's existence. If you go to Stores -> Configuration -> Full Page Cache -> Caching Application in the admin panel, you will see the setting set to "Built-In Cache" as opposed to being set to "Varnish Cache". As such, the following are occurring:

  • Magento is not communicating to Varnish. As such, if custom code determines that a page which normally would be flagged should not be flagged, Magento has no way of telling Varnish not to cache it
  • Magento is still caching pages in the built-in cache while Varnish also caches pages

Was this the intended setup? It seems odd that Varnish would be included in this stack, but that Magento would not be set to use it.

dunagan5887 avatar Mar 07 '17 23:03 dunagan5887

Are you having problems using Varnish when you set the "Caching Application" setting to "Varnish Cache" in the admin panel?

punkstar avatar Apr 24 '17 13:04 punkstar

It does appear to work when updating the admin panel, just wondering if there were any plans to make the admin panel setting occur as part of the build process

dunagan5887 avatar Apr 24 '17 16:04 dunagan5887

We should update the setup to set Varnish as the default caching application.

punkstar avatar Jun 08 '17 08:06 punkstar

This can be done post install using the magerun wrapper

docker-compose run cli bash cd /var/www/magento/ magerun2 config:store:set system/full_page_cache/caching_application 2 magerun2 config:store:set system/full_page_cache/varnish/grace_period 300 magerun2 config:store:set system/full_page_cache/varnish/backend_port 80 magerun2 config:store:set system/full_page_cache/varnish/backend_host web magerun2 config:store:set system/full_page_cache/varnish/access_list web

But even with this in place I'm not convinced Magento is using varnish. Should we not see an X-Cache – Either HIT or MISS in the document headers among other things?

https://docs.acquia.com/acquia-cloud/performance/varnish/headers/

DominicWatts avatar Oct 31 '18 21:10 DominicWatts