Take the 2-minute tour ×

Can I configure Varnish in such a way it shows the original page from the backend when the backend throws a 500 error page?

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

It's the default. I have some if (beresp.status == 500) in it :s

share|improve this answer
Great question. But I need more from your answer. Mine has some if (beresp.status == 500) as well, and I assume you need to do something in that case. How then do you deliver the original back end 500 error page? –  Mojo Jan 24 '13 at 17:52
add comment

I assume you want to show the original 500 error only in some environments, like development.

If so, then you can assign Varnish an identity:

$ varnishd -i development

And then check that identity in your VCL:

sub vcl_fetch {
  if (server.identity ~ "^development") {
    return (deliver);

  if (beresp.status == 500) {
    # ...
share|improve this answer
add comment

Your Answer


