I have some problems with form_key when default FULL PAGE CACHE enabled. And i found out that page-cache.js doesn't load in head section. And there is no "X-Cache:" headers. I've tried everything..

Why can it be? And how it should loading?

Solved! Solution is here - https://magento.stackexchange.com/a/291924/83140


Answering your question: the most common cause why FPC is not working is persistence of some block which is not cacheable (in layout block has cacheable="false").

You are expecting the wrong indicator. Let's have a look at how FPC works:

<type name="Magento\Framework\App\FrontControllerInterface">
    <plugin name="front-controller-builtin-cache" type="Magento\PageCache\Model\App\FrontController\BuiltinPlugin"/>
    <plugin name="front-controller-varnish-cache" type="Magento\PageCache\Model\App\FrontController\VarnishPlugin"/>

Here are two ways: if we use native FPC or Varnish. No FrontController native workflow if the page is cached.

Native FPC

public function aroundDispatch(FrontControllerInterface $subject, \Closure $proceed, RequestInterface $request)
    if (!$this->config->isEnabled() || $this->config->getType() != \Magento\PageCache\Model\Config::BUILT_IN) {
        return $proceed($request);
    $result = $this->kernel->load();
    if ($result === false) {
        $result = $proceed($request);
        if ($result instanceof ResponseHttp) {
    } else {
        $this->addDebugHeader($result, 'X-Magento-Cache-Debug', 'HIT', true);
    return $result;

Let's have a look at process()

 * Handle private content version cookie set cookie if it is not set.
 * Increment version on post requests. In all other cases do nothing.
 * @return void
public function process()
    if ($this->request->isPost()) {
        $publicCookieMetadata = $this->cookieMetadataFactory->createPublicCookieMetadata()
        $this->cookieManager->setPublicCookie(self::COOKIE_NAME, $this->generateValue(), $publicCookieMetadata);

Original comment tells everything. When post request we set a cookie with the name private_content_version

Try to load content from cache and if it exists - loads it and set a header with the name X-Magento-Cache-Debug (In developer mode only)

Varnish instead of FPC

public function afterDispatch(FrontControllerInterface $subject, $result)
    if ($this->config->getType() == Config::VARNISH && $this->config->isEnabled()
        && $result instanceof ResponseHttp
    ) {

        if ($this->state->getMode() == AppState::MODE_DEVELOPER) {
            $result->setHeader('X-Magento-Debug', 1);

    return $result;

Same process() method and header 'X-Magento-Debug'.

| improve this answer | |
  • It's a good answer. Thank you! I've found one instance of "cacheable="false" in custom theme layout. Removing this doesn't solved the problem. But, i've changed theme to Luma - and page-chache.js appeared. The problem is in custom theme, but not in "cacheable="false"... – Alexey Uvarov Oct 7 '19 at 11:54
  • Can it be custom js, or wrong redeclaring of default containers in layout? – Alexey Uvarov Oct 7 '19 at 12:02
  • It is custom Magento_Theme default.xml problem. I've removed it, and page-cache.js loaded. – Alexey Uvarov Oct 7 '19 at 12:09
  • Most likely that was not the only block which isn't cacheable. I remember there was one good article with example how quickly debug this.. I didn't check this way. Only manual looking for blocks which break everything: mirasvit.com/blog/… – zhartaunik Oct 7 '19 at 13:19

Solved. The problem was in custom Magento_Theme default.xml layout. There was

  <referenceContainer name="main">
        <container name="content.top" label="Main Content Top"/>
        <container name="content" label="Main Content Area"/>
        <container name="content.aside" label="Main Content Aside"/>
        <container name="content.bottom" label="Main Content Bottom"/>

It's the same as in Magento module-theme default.xml . As i can understand - it was wrong redeclaring of containers. Correct me if I'm wrong.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.