docker-magento2
docker-magento2 copied to clipboard
Magento not being set to use Varnish
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.
Are you having problems using Varnish when you set the "Caching Application" setting to "Varnish Cache" in the admin panel?
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
We should update the setup to set Varnish as the default caching application.
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/