1

I install varnish(5) just like here: https://devdocs.magento.com/guides/v2.2/config-guide/varnish/config-varnish.html

I make test from varnish cli

varnishd -d -f /etc/varnish/default.vcl

start
Debug: Child (26063) Started
200 0

Info: Child (26063) said Child starts

Everything looks ok.

But when I try run curl test:

curl -I -v --location-trusted 'https://mymagento.com'

I don't see any varnish headers.

How can I debug this problem? Or where can I look for some tips?

0

Check this section in /etc/varnish/default.vcl

sub vcl_deliver

You'll notice that some headers were unset e.g.

unset resp.http.X-Varnish
unset resp.http.X-Magento-Debug;

Comment them out if you want to see them in the response headers.

Also make sure that you set your Magento 2 environment to 'developer'

0
  1. Varnish header request only displays in developer mode. Click Here

First, make sure you are using Magento’s developer mode; otherwise, you won’t see the headers.

  1. Make sure the varnish cache set in the backend as a full-page cache in store -> configuration -> advanced -> full page cache
3
  • Yes, I know. I don't see headers in developer mode :). I see others Magento headers like X-Magento-Debug: 1 but not those from varnish.
    – Maciej
    May 4 '18 at 17:58
  • if possible, please paste the results. May 4 '18 at 18:02
  • @Maciej, do you got any solution for this?
    – anujeet
    Jun 17 '20 at 11:03
0

My Response headers are give below:

Cache-Control: max-age=0, must-revalidate, no-cache, no-store
Connection: keep-alive
Content-Encoding: gzip
Content-Type: text/html; charset=UTF-8
Date: Tue, 08 May 2018 09:21:19 GMT
Expires: Mon, 08 May 2017 09:20:52 GMT
Pragma: no-cache
Server: nginx/1.10.3
Set-Cookie: form_key=HfXDuOKLNlnRkV3x; expires=Tue, 08-May-2018 10:20:52 GMT; Max-Age=3600; path=/; domain=
Set-Cookie: PHPSESSID=s72hj0entb9avq6f8vtkt53bcu; expires=Tue, 08-May-2018 10:20:52 GMT; Max-Age=3600; path=/; domain=; HttpOnly
Transfer-Encoding: chunked
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Magento-Debug: 1
X-XSS-Protection: 1; mode=block
0

X-Magento-Debug is from varnish.

If you read the vcl file, you will see X-Magento-Debug there. It will change to X-Magento-Cache-Debug once you're in production mode.

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.