-
-
Notifications
You must be signed in to change notification settings - Fork 20
Description
The preload tags and http header links are added onto the http response (presumably) after magento saves it into page cache.
With page cache enabled the first load will have all the preloads in the http header and in the but on the second load, when the page is cached in full_page cache, some of these preloads disappear.
A little bit of debugging brought me to the following piece of code.
public function parse(HttpResponse $response)
{
$this->addLinkHeadersFromResponse($response);
$this->addLinkHeadersFromLayout();
$this->processHeaders($response);
$this->processBody($response);
$this->reset();
}
Here it attempts to add the links from the layout by retrieving the 'link-preload' block
$block = $this->layout->getBlock('link-preload');
This is however not possible, since the layout doesn't get generated since we're loading a page that is in full_page cache. This results in the added layout items not being added.
I believe a way of solving this is by caching the links in magento somewhere (specific to a page) and then using that cache to build the preload links when a page is in full_page cache.