We have installed varnish on our server today to speed up our webshop. And it is very effective. We use W3 Total Cache configured with MaxCDN and Redis to manage the cache in WordPress. But some pages on our shop now are printed twice in the browser (in the source it contains 2 tags) and all scripts are loaded twice, which slows down the site on that pages.

Has anybody experience with this problem, or an idea how to solve this?

  • You're not using edge side includes (ESI), right? Otherwise, varnish shouldn't change the body at all, so I'd look very closely at the backend. Do you see two requests from varnish in the backend's access log? Does this also happen when you go through varnish but don't hit the cache (e.g. appending ?1234 to the URL)? – janh Feb 6 '18 at 10:03
  • No, We don't use ESI indeed. When I run varnishlog I see multiple requests when I request a page which is printed twice. Is there a way to only get the requested URI instead of the whole request with all headers? When I add ?1234 to the URL, the page is loading correctly. – NVO Feb 6 '18 at 10:28
  • I try to avoid varnishlog whenever possible, so I can't really help there. I guess you do have nginx or something else in front of varnish - do you get the duplicate output also if you go directly to varnish (via curl, for example)? And is the output actually duplicate, or are there subtle differences? Does it happen with simple, static files as well? – janh Feb 6 '18 at 10:34

Your Answer

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

Browse other questions tagged or ask your own question.