Most common issue is a block included in all pages with cacheable = false.
Maybe an extension with this declaration in default.xml.
vendor/magento/framework/View/Layout.php, function isCacheable.
`$this->getXml()->xpath('//' . Element::TYPE_BLOCK . '[@cacheable="false"]')`
To debug page load and save, see bellow. But before it, I would start with the above.
The page is loaded/saved from page cache type with these entry points:
This class is an around plugin on
renderResult function. Layout is a more complex version of
Raw builds a page in a string (
$content = 'All that it is';). Layout builds the page using XML layout (a tree of blocks/ a tree of strings).
All plugins contain straight forward code and there is no need for further code explanation.
HIT when the page is found in cache. If not in cache, than it allows the application to build the content (html; there is a check that JSON should not be cached, ..) and saves in cache page's html for the next time.
In the 2 plugins (FrontController mostly) you can start debugging and see when it fails. The cause of your issue will be exposed by other parts of the code and to me it looks like it's caused by your setup.
If anything, there is a fix in Kernel.php
I personally find it odd.