I use cache warmer (Mirasvit) with Varnish. Cache warmer doesn't work correctly - either doesn't warm up product pages (config from: https://www.varnish-software.com/developers/tutorials/configuring-varnish-magento/) or nothing at all when standard config is in use.
What kind of changes does standard varnish config require to warm up cache properly?
UPDATE:
Above issue was a result of applying vcl file generated by Magento 2.4.4
Upon restoring previous vcl file, all came back to normal. Question is whether vcl file was/is generated with errors or cache warmer isn't compatible anymore...
UPDATE2:
So far, I've identified this code in sub vcl_deliver (Magento 2.4.4 generated):
if (resp.http.Cache-Control !~ "private" && req.url !~ "^/(pub/)?(media|static)/") {
set resp.http.Pragma = "no-cache";
set resp.http.Expires = "-1";
set resp.http.Cache-Control = "no-store, no-cache, must-revalidate, max-age=0";
}
Do you have it generated as well?
varnishlog ouput:
varnishlog -g request -q "ReqUrl eq '/'"
* << Request >> 197620
- Begin req 197619 rxreq
- Timestamp Start: 1660390146.713244 0.000000 0.000000
- Timestamp Req: 1660390146.713244 0.000000 0.000000
- VCL_use boot
- ReqStart 127.0.0.1 49184 a0
- ReqMethod GET
- ReqURL /
- ReqProtocol HTTP/1.1
- ReqHeader Host: test.page.com
- ReqHeader X-Forwarded-Host: test.page.com
- ReqHeader X-Real-IP: X.X.X.X
- ReqHeader X-Forwarded-For: X.X.X.X
- ReqHeader Ssl-Offloaded: 1
- ReqHeader X-Forwarded-Proto: https
- ReqHeader X-Forwarded-Port: 443
- ReqHeader Connection: close
- ReqHeader accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
- ReqHeader accept-encoding: gzip, deflate, br
- ReqHeader user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6 Safari/605.1.15
- ReqHeader accept-language: pl-PL,pl;q=0.9
- ReqHeader referer: https://test.page.com/eko-curry-60g-dary-natury
- ReqHeader cookie: section_data_ids=%7B%22rewards%22%3A1660389966%2C%22recently_compared_product%22%3A1660389969%2C%22cart%22%3A1660151152%2C%22customer%22%3A1660151152%2C%22captcha%22%3A1660151152%2C%22recently_viewed_product%22%3A1660389776%2C%22directory-data%22
- ReqUnset X-Forwarded-For: X.X.X.X
- ReqHeader X-Forwarded-For: X.X.X.X, 127.0.0.1
- VCL_call RECV
- ReqHeader grace: none
- ReqURL /
- ReqUnset accept-encoding: gzip, deflate, br
- ReqHeader Accept-Encoding: gzip
- VCL_return hash
- VCL_call HASH
- VCL_return lookup
- Hit 202 85836.119597 259200.000000 0.000000
- VCL_call HIT
- VCL_return deliver
- RespProtocol HTTP/1.1
- RespStatus 200
- RespReason OK
- RespHeader Server: nginx
- RespHeader Date: Sat, 13 Aug 2022 11:19:42 GMT
- RespHeader Content-Type: text/html; charset=UTF-8
- RespHeader Last-Modified: Fri, 05 Aug 2022 20:47:14 GMT
- RespHeader Pragma: cache
- RespHeader Cache-Control: max-age=86400, public, s-maxage=86400
- RespHeader Expires: Sun, 14 Aug 2022 11:19:42 GMT
- RespHeader X-Magento-Tags: store,cms_b,gdpr_c,theme_editor_backend_css_block,cms_b_header_cms_links,cms_b_argento_scroll_up,cms_b_footer_cms_content,cms_b_13,cms_b_8,cms_b_info_o_sklepie,cms_p_2,easyslide_slider_4,placeholder__1,banner__1,easycatalogimg_subcategori
- RespHeader Report-To: {"group":"report-endpoint","max_age":10886400,"endpoints":[{"url":"https:\/\/zakreconysloik.report-uri.com\/r\/d\/csp\/reportOnly\/"}]}
- RespHeader Content-Security-Policy-Report-Only: font-src *.fontawesome.com maxcdn.bootstrapcdn.com fonts.gstatic.com https://geowidget.easypack24.net *.cloudflare.com *.twitter.com *.gstatic.com *.googleapis.com *.bootstrapcdn.com 'self' data: test.zakreconysloik.c
- RespHeader Strict-Transport-Security: max-age=31536000
- RespHeader Content-Security-Policy: upgrade-insecure-requests;
- RespHeader X-Content-Type-Options: nosniff
- RespHeader X-XSS-Protection: 1; mode=block
- RespHeader X-Frame-Options: SAMEORIGIN
- RespHeader Vary: Accept-Encoding
- RespHeader Content-Encoding: gzip
- RespHeader X-Varnish: 197620 202
- RespHeader Age: 563
- RespHeader Via: 1.1 varnish (Varnish/7.0)
- RespHeader Accept-Ranges: bytes
- VCL_call DELIVER
- RespUnset Age: 563
- RespUnset Pragma: cache
- RespHeader Pragma: no-cache
- RespUnset Expires: Sun, 14 Aug 2022 11:19:42 GMT
- RespHeader Expires: -1
- RespUnset Cache-Control: max-age=86400, public, s-maxage=86400
- RespHeader Cache-Control: no-store, no-cache, must-revalidate, max-age=0
- RespUnset X-Magento-Tags: store,cms_b,gdpr_c,theme_editor_backend_css_block,cms_b_header_cms_links,cms_b_argento_scroll_up,cms_b_footer_cms_content,cms_b_13,cms_b_8,cms_b_info_o_sklepie,cms_p_2,easyslide_slider_4,placeholder__1,banner__1,easycatalogimg_subcategori
- RespUnset Server: nginx
- RespUnset X-Varnish: 197620 202
- RespUnset Via: 1.1 varnish (Varnish/7.0)
- VCL_return deliver
- Timestamp Process: 1660390146.713393 0.000149 0.000149
- Filters esi
- RespHeader Connection: close
- RespHeader Transfer-Encoding: chunked
- Link req 197621 esi
- Timestamp Resp: 1660390146.714287 0.001043 0.000894
- ReqAcct 1650 0 1650 6363 185868 192231
- End
** << Request >> 197621
-- Begin req 197620 esi
-- Timestamp Start: 1660390146.713558 0.000000 0.000000
-- ReqURL /page_cache/block/esi/blocks/%5B%22navpro.topnav%22%5D/handles/WyJkZWZhdWx0IiwiY21zX2luZGV4X2luZGV4IiwiY21zX3BhZ2VfdmlldyIsImN1c3RvbWVyX2xvZ2dlZF9pbiJd/
-- ReqUnset Host: test.page.com
-- ReqHeader Host: test.page.com
-- ReqUnset accept-encoding: gzip, deflate, br
-- ReqHeader Accept-Encoding: gzip
-- ReqStart 127.0.0.1 49184 a0
-- ReqMethod GET
-- ReqURL /page_cache/block/esi/blocks/%5B%22navpro.topnav%22%5D/handles/WyJkZWZhdWx0IiwiY21zX2luZGV4X2luZGV4IiwiY21zX3BhZ2VfdmlldyIsImN1c3RvbWVyX2xvZ2dlZF9pbiJd/
-- ReqProtocol HTTP/1.1
-- ReqHeader X-Forwarded-Host: test.page.com
-- ReqHeader X-Real-IP: X.X.X.X
-- ReqHeader X-Forwarded-For: X.X.X.X
-- ReqHeader Ssl-Offloaded: 1
-- ReqHeader X-Forwarded-Proto: https
-- ReqHeader X-Forwarded-Port: 443
-- ReqHeader Connection: close
-- ReqHeader accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
-- ReqHeader user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6 Safari/605.1.15
-- ReqHeader accept-language: pl-PL,pl;q=0.9
-- ReqHeader referer: https://test.page.com/eko-curry-60g-dary-natury
-- ReqHeader cookie: section_data_ids=%7B%22rewards%22%3A1660389966%2C%22recently_compared_product%22%3A1660389969%2C%22cart%22%3A1660151152%2C%22customer%22%3A1660151152%2C%22captcha%22%3A1660151152%2C%22recently_viewed_product%22%3A1660389776%2C%22directory-data%22
-- ReqHeader Host: test.page.com
-- ReqHeader Accept-Encoding: gzip
-- ReqUnset X-Forwarded-For: X.X.X.X
-- ReqHeader X-Forwarded-For: X.X.X.X, 127.0.0.1
-- VCL_call RECV
-- ReqHeader grace: none
-- ReqURL /page_cache/block/esi/blocks/%5B%22navpro.topnav%22%5D/handles/WyJkZWZhdWx0IiwiY21zX2luZGV4X2luZGV4IiwiY21zX3BhZ2VfdmlldyIsImN1c3RvbWVyX2xvZ2dlZF9pbiJd/
-- ReqUnset Accept-Encoding: gzip
-- ReqHeader Accept-Encoding: gzip
-- VCL_return hash
-- VCL_call HASH
-- VCL_return lookup
-- Hit 204 3036.540065 259200.000000 0.000000
-- VCL_call HIT
-- VCL_return deliver
-- RespProtocol HTTP/1.1
-- RespStatus 200
-- RespReason OK
-- RespHeader Server: nginx
-- RespHeader Date: Sat, 13 Aug 2022 11:19:43 GMT
-- RespHeader Content-Type: text/html; charset=UTF-8
-- RespHeader Last-Modified: Fri, 05 Aug 2022 20:47:14 GMT
-- RespHeader X-Magento-Tags: NAVIGATIONPRO_MENU_6
-- RespHeader Pragma: cache
-- RespHeader Cache-Control: max-age=3600, public, s-maxage=3600
-- RespHeader Expires: Sat, 13 Aug 2022 12:19:43 GMT
-- RespHeader Report-To: {"group":"report-endpoint","max_age":10886400,"endpoints":[{"url":"https:\/\/zakreconysloik.report-uri.com\/r\/d\/csp\/reportOnly\/"}]}
-- RespHeader Content-Security-Policy-Report-Only: font-src *.fontawesome.com maxcdn.bootstrapcdn.com fonts.gstatic.com https://geowidget.easypack24.net *.cloudflare.com *.twitter.com *.gstatic.com *.googleapis.com *.bootstrapcdn.com 'self' data: test.zakreconysloik.c
-- RespHeader Strict-Transport-Security: max-age=31536000
-- RespHeader Content-Security-Policy: upgrade-insecure-requests;
-- RespHeader X-Content-Type-Options: nosniff
-- RespHeader X-XSS-Protection: 1; mode=block
-- RespHeader X-Frame-Options: SAMEORIGIN
-- RespHeader Vary: Accept-Encoding
-- RespHeader Content-Encoding: gzip
-- RespHeader X-Varnish: 197621 204
-- RespHeader Age: 563
-- RespHeader Via: 1.1 varnish (Varnish/7.0)
-- RespHeader Accept-Ranges: bytes
-- VCL_call DELIVER
-- RespUnset Age: 563
-- RespUnset Pragma: cache
-- RespHeader Pragma: no-cache
-- RespUnset Expires: Sat, 13 Aug 2022 12:19:43 GMT
-- RespHeader Expires: -1
-- RespUnset Cache-Control: max-age=3600, public, s-maxage=3600
-- RespHeader Cache-Control: no-store, no-cache, must-revalidate, max-age=0
-- RespUnset X-Magento-Tags: NAVIGATIONPRO_MENU_6
-- RespUnset Server: nginx
-- RespUnset X-Varnish: 197621 204
-- RespUnset Via: 1.1 varnish (Varnish/7.0)
-- VCL_return deliver
-- Timestamp Process: 1660390146.713642 0.000084 0.000084
-- Filters
-- RespHeader Content-Length: 4917
-- Timestamp Resp: 1660390146.713808 0.000250 0.000165
-- ReqAcct 0 0 0 0 4917 4917
-- End
User-Agent
this cache warmer uses and then we can filter the Varnish logs for this agent and figure out what's going on. If you let me know whichUser-Agent
value to look for, I'll help you set up thevarnishlog
command to figure out if anything is coming in or if Varnish is not correctly caching these requests.varnishlog -g request -q "ReqUrl eq '/'"
to capture cache warming attempts on the homepage. Please set up a test case and try to capture caching warming attempts with the appropriatevarnishlog
command. Just add the output to your question and I'll look into it.