Serving static html when all backends are sick

Thijs Cramer t.cramer at beslist.nl
Wed Dec 7 09:29:40 CET 2016


Given the following code:

=========================================
sub vcl_synth {
  if (resp.status == 999) {
    set resp.status = 200;
    set resp.http.Content-Type = "text/html; charset=utf-8";
    synthetic( {"Static HTML"} );
    return(deliver);
  }
}

# Check if backend is healthy, otherwise, redirect
if (!std.healthy(req.backend_hint)) {
  return (synth(999, "All backends down."));
}

=========================================

Will the static page be served if ALL backends are down, or just when
the specific backend it got back from the backend_hint is down?

We want to be able to serve static html as a fallback if all backends
are down.

Is this the proper way to do this?

Thanks in advance!

- Thijs



More information about the varnish-misc mailing list