Does setting beresp.ttl to 0s replace previous cache?

167 views Asked by At

I have this issue, I use Varnish 3.0 and I want to avoid caching errors. I'm aware that this piece of code should do it:

 if (beresp.status >= 500) {
  set beresp.saintmode = 2m;
  if (req.request != "POST") {
       set beresp.ttl = 0s;
       return(restart);
  } else {
       set beresp.ttl = 1s;
       error 500 "Failed";
  }
}

However, what concerns me is Varnish replacing old cache with the given error. I mean, I don't want Varnish to return a cached error if my backend is down (I have set grace mode).

So, my question is if Varnish replace the object stored for grace mode when setting beresp.ttl = 0s;

1

There are 1 answers

1
Redithion On BEST ANSWER

Well, I've just did some tests and Varnish does not replace the object cached.