I installed Varnish on my Magento 2 store. All pages such as cart page, product pages, category pages, account pages are working fine and served by Varnish perfectly. The issue is in CMS page such as Home Page, About Page etc. Its giving me 500 errors (Internal Server Error).

Note: This is not the 503 Guru Meditation Page.

I have also checked magento logs which is not giving any hint. The Apache log throws "Premature end of script headers: index.php". Varnishlog also gives nothing except 500 Response.

1 Answer 1


This is clearly an issue related to your PHP or PHP runtime settings.

As you indicated, it's not the 503 Guru Meditation error that Varnish generates. The 500 error you're getting will not be cached by Varnish, because it's a non-cacheable status code.

Premature end of script header is something that your webserver or the FastCGI gateway returns.

Are you using PHP-FPM or PHP via traditional FastCGI ?

Anyway, in terms of a solution, you'll have to start a debugging process and try to figure out on which line the program bails out.

Typical things you can do is:

  • Resetting the permissions
  • Clearing the Magento caches
  • Enabling developer mode
  • Enabling the profiler

Maybe that will shed more light on what is going on.

  • No, I am not using PHP-FPM. Strange things is: With Built-in cache, everything is working fine. Once I choose Varnish cache, it appears 500 error on CMS pages. I did a "curl -I domain.com", where I can see Varnish is serving well as well. Jun 2, 2020 at 3:38
  • As mentioned, I guess it's time to start debugging your Magento application and figure out what is causing this error. If you find an error message, please share it here, and I'll try to help you out. Jun 3, 2020 at 6:41

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.