magento/magento2 — pull request #726 by Marko-M (2014-11-02 11:55:07+00:00)
Title: Do not save page cache data when Varnish is active

Here I describe and provide possible solution for issue where built in Magento 2 page cache does caching even when Varnish is enabled:

https://github.com/magento/magento2/blob/master/app/code/Magento/PageCache/Model/Controller/Result/BuiltinPlugin.php#L90

Since triggering built in caching code involves sending no cache headers:

https://github.com/magento/magento2/blob/master/lib/internal/Magento/Framework/App/PageCache/Kernel.php#L84

this results with 100% cache MISS after enabling Varnish, since with Magento2 provided .vcl it fully respects no cache headers issued by code that shouldn't be executed in the first place:

https://github.com/magento/magento2/blob/master/lib/internal/Magento/Framework/App/Response/Http.php#L164-L166

and passes all requests directly to backend. This solution simply does check already implemented for fetching built in page cache data:

https://github.com/magento/magento2/blob/master/app/code/Magento/PageCache/Model/App/FrontController/BuiltinPlugin.php#L84-L86

to saving page data by built in cache code.