Mailing List Archive

Any chance to support "max-stale" request header in Varnish?
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
header?

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

--
Michael Lee / Managing Director / ZerusTech Ltd

Tel: +86 (21) 6107 3305

Mobile: +86 186 021 03818

Skype: zerustech

Email: michael.lee@zerustech.com

www.zerustech.com

Suite 9208
Building No. 9, 4361 HuTai Road
Shanghai
P.R.China
201906


_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
Re: Any chance to support "max-stale" request header in Varnish? [ In reply to ]
> 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

You can't trust clients, so Varnish will not likely honor clients'
claims, like no-cache or max-stale. If you want to give control to the
clients (which I don't recommend for the general case) you have do
painfully do it yourself in VCL. It's a bit tedious to implement.

> controlled by varnish. But still, unless we shut down the backend server,
> there is no way to demonstrate the "grace" for single request either.

There is, you can see the Age header going above the Cache-Control's
mas-age when it happens.

_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
Re: Any chance to support "max-stale" request header in Varnish? [ In reply to ]
Thanks for your feedback.

On 11/30/16 5:59 PM, Dridi Boukelmoune wrote:
>> 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
> You can't trust clients, so Varnish will not likely honor clients'
> claims, like no-cache or max-stale. If you want to give control to the
> clients (which I don't recommend for the general case) you have do
> painfully do it yourself in VCL. It's a bit tedious to implement.
>
>> controlled by varnish. But still, unless we shut down the backend server,
>> there is no way to demonstrate the "grace" for single request either.
> There is, you can see the Age header going above the Cache-Control's
> mas-age when it happens.
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc@varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>

--
Michael Lee / Managing Director / ZerusTech Ltd

Tel: +86 (21) 6107 3305

Mobile: +86 186 021 03818

Skype: zerustech

Email: michael.lee@zerustech.com

www.zerustech.com

Suite 9208
Building No. 9, 4361 HuTai Road
Shanghai
P.R.China
201906


_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc