Make lacquer cache a synthetic response for ESI crash

We use varnish 4 for ESI caching and handling. For ESI requests that return a 5XX backback error, we return an empty synthetic response.

This empty response should be cached for a few seconds, because currently every subsequent request to the same ESI goes to the backend again. This puts a lot of strain on our servers when the 5XX response reason is costly.

sub vcl_backend_error {
    ....
    if (isAnESI && beresp.status >= 500 && beresp.status <= 599) {
        synthetic({""});

        return(deliver);
    }
}

      

We tried adding a title Retry-After

to the answer, but that doesn't do the trick.

set beresp.http.Retry-After = "5";

      

+3


source to share





All Articles