3

Installed the latest Magento 2 beta3 release with sample data, and configured Varnish, and enabled Varnish debugging in vcl file. When requesting a page, and refreshing, I see the css, js files, etc... are all cached (showing HIT) but the response headers for the magento pages show:

Referer:http://xxx/magento2/men/tops-men/tees-men.html
    Via:1.1 varnish
    X-Magento-Cache-Control:no-store, no-cache, must-revalidate, max-age=0
    X-Magento-Cache-Debug:MISS
    X-Varnish:1005693536

I have Varnish enabled in the admin panel (Full Page Cache set to "Varnish Caching") and the generated vcl loaded into Varnish.

Is this the expected result for the Magento pages themselves? Should I see a "HIT" for the Magento page in Varnish? Just trying to better understand how it works and how best to configure it.

1
  • ok, I reset varnish, changed caching to built-in, made sure FPC cache was enabled and flushed, then set back to varnish caching mode, saved, and now seeing cache hits on pages. May have been bug or just a weird saved state. Jan 10, 2015 at 21:04

1 Answer 1

8

The answer I found is, Yes, a Varnish HIT should be recorded for cached pages in Magento 2 when Varnish is properly enabled. By properly, I mean:

  • Varnish installed and running
  • Magento 2 configured to use Varnish as FPC (Stores -> Configuration -> System -> "Full Page Cache"
  • Download the vcl Magento gives you in the above admin area and load it into Varnish.
  • Make sure that the "Page Cache" under System -> Cache Management is also enabled and refreshed.

To see the HIT in the HTTP response headers, you need to edit the vcl file and comment out the line:

unset resp.http.X-Varnish;

For Debug lines in the header response, put Magento into Developer mode, and make sure the resp.http.X-Magento-Debug is set (or unset commented out).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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