Any chance to support "max-stale" request header in Varnish?

Michael Lee michael.lee at
Wed Nov 30 08:32:02 CET 2016

Hi Guys,

I am working on a tutorial of HTTP/1.1 caching and I'd like to use 
Varnish as the reverse proxy to demonstrate how HTTP/1.1 caching works. 
However, I found there is no way to support the max-stale request header 
("Cache-Control: max-stale=...").

The problem is that "a call to return(deliver)" always triggers a 
backend fetch, explicitly, if the object's ttl has been exceeded, so 
it's impossible to deliver a staled object for a single request.

The workaround might be shutting down the backend server to force a 
failure of the backend fetch, thus to get the staled object delivered. 
But besides that, is there any better solution to support the max-stale 

In fact, the "max-stale" header is almost identical to "grace", except 
that the "max-stale" header is controlled by the client, while the 
"grace" is controlled by varnish. But still, unless we shut down the 
backend server, there is no way to demonstrate the "grace" for single 
request either.

Kind regards,


Michael Lee / Managing Director / ZerusTech Ltd

Tel: +86 (21) 6107 3305

Mobile: +86 186 021 03818

Skype: zerustech

Email: michael.lee at

Suite 9208
Building No. 9, 4361 HuTai Road

More information about the varnish-misc mailing list