Conditional requests / if-modified-since not working

Raphaël Malié raphael.malie at gmail.com
Sat Jan 23 00:14:40 CET 2016


Hi Guillaume,

It works, finally!

Many thanks,
Raphaël

2016-01-22 21:50 GMT+01:00 Guillaume Quintard <
guillaume at varnish-software.com>:

> Hi Raphaël,
>
> Varnish ignores the must revalidate header, if you wish to emulate the
> behaviour, you can use something like this in your vcl:
>
> sub vcl_backend_response {
>     if (beresp.http.cache-control ~ "must-revalidate") {
>         set beresp.ttl = 1s;
>         set beresp.grace = 0s;
>         set beresp.keep = 1w;
>     }
> }
>
> This way, you'd only cache for 1 second (don't set it to 0, or all the
> requests for this object would be done sequentially), but will keep the
> object for a week, revalidating it each time it is requested and its ttl is
> expired.
>
> --
> Guillaume Quintard
>
> On Fri, Jan 22, 2016 at 3:32 PM, Raphaël Malié <raphael.malie at gmail.com>
> wrote:
>
>> Hello,
>>
>> I did a fresh install of Varnish 4.1 to test conditional requests with a
>> last-modified header sent from the backend, here are my backend headers:
>>
>> Cache-Control: must-revalidate, proxy-revalidate, public
>> Last-Modified: Fri, 22 Jan 2016 14:27:50 GMT
>>
>> On the next query, Varnish should try to contact the backend with a
>> if-modified-since header, and the backend shoud send back a "304 not
>> modified" answer if nothing changed.
>>
>> But Varnish never tries to contact the backend, he is always caching my
>> page with the default ttl (120s).
>>
>> Thank you for any help,
>> Raphaël
>>
>> _______________________________________________
>> varnish-misc mailing list
>> varnish-misc at varnish-cache.org
>> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20160123/ee840119/attachment.html>


More information about the varnish-misc mailing list