3

A JSON response something like as shown below should be returned if the underlying backend is down or something.

{
    "msg" :{
        "status": 2
    }
}

Is this possible with varnish ?

Yasser Shaikh
  • 391
  • 1
  • 3
  • 7

1 Answers1

3

How about this:

sub vcl_backend_error {
    set beresp.http.Content-Type = "application/json; charset=utf-8";
    synthetic( {"{ "msg" :{ "status": 2 } }"} );
    return (deliver);
}
Danila Vershinin
  • 5,286
  • 5
  • 17
  • 21