0

For a long time I've been having an issue with the top navigation bar in Magento 2.3 not showing the first time a page is requested after varnish cache is cleared. On subsequent requests of the same page (e.g hitting Refresh) the nav bar shows normally. This happens on any page: Home page, Category Page, Product page, Search etc.

The issue is obviously related to varnish because the <esi:include> for the nav bar is left intact but other <esi:include> are processed normally.

I've tried clearing caches, setup:di:compile, redeploying static content but nothing worked so far. I am at a loss as to how to troubleshoot the issue.

Using Magento 2.3.4 with Varnish 4.0.2. I cannot really modify varnish configuration/VCLs as this is managed by my host (Cloudways)

Related logs:
Varnish log
Apache access log
magento2_recv.vcl
magento2_backend.vcl

(Please note logs have been truncated to only include related requests, but still they are to large to embed in the question)

1 Answer 1

0

Can you add some varnishlog output for this request, so we can see what's going on within Varnish? Please run the following command: varnishlog -g request -q "ReqUrl eq '/'"

This command assumes the issue happens on the homepage. If it occurs on another page please, adjust the ReqUrl eq '/' part.

You mentioned that you can't modify the VCL, hopefully you have access to the VCL to share it here. I'd love to see the mechanisms in the VCL file that are responsible for the ESI parsing.

3
  • Added logs and VCLs. At first look in appache logs it appears as if there is a request for the missing ESI block, yet it is not injected in the resulting page. Wondering if timing makes any difference (e.g. backend responding too slow) Commented Apr 24, 2020 at 9:07
  • I looked at your logs and I'm not seeing it. Are these the logs from the moment it all goes wrong? You were saying that the 1st request after a cache flush results in an unparsed ESI placeholder. I'd love to see what's going on there. Based on your VCL, ESI parsing kicks in when the content-type header matches the value text. Hopefully you can provide some logs that are pointing in that direction. Otherwise it's going to be hard to figure out what's going on. Commented Apr 28, 2020 at 8:41
  • Yes these are the logs from the moment it goes wrong. I flushed varnish, started varnish log, refreshed my browser and the nav bar was missing. Then I stopped varnish log. Varnish log was posted in its entirety, apache log was trimmed to contain the time span in question. If there are any other logs or tests I could try I'd be happy to do so. Commented Apr 28, 2020 at 22:32

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.