Support for If-None-Match header.
Reza Naghibi
reza at varnish-software.com
Mon Jan 23 20:42:07 CET 2017
Actually, the VCL can be simplified greatly (I was expecting to change the
Etag while writing that):
---
sub vcl_backend_response
{
set beresp.http.Vary = "If-None-Match";
}
---
If there is a previous value of Vary, just append the If-None-Match.
--
Reza Naghibi
Varnish Software
On Mon, Jan 23, 2017 at 12:28 PM, Reza Naghibi <reza at varnish-software.com>
wrote:
> You could vary on the Etag which will keep multiple Etag versions in cache
> while allowing for 304 responses on each one:
>
> ---
>
> vcl 4.0;
>
> backend default
> {
> .host = "127.0.0.1";
> .port = "80";
> }
>
> sub vcl_recv
> {
> if (req.http.If-None-Match) {
> set req.http.ETag = req.http.If-None-Match;
> }
> }
>
> sub vcl_backend_response
> {
> set beresp.http.Vary = "ETag";
> }
>
> ---
>
> I may have misunderstood the question, but your backend would have to
> return the correct response matching upto the Etag.
>
> --
> Reza Naghibi
> Varnish Software
>
> On Mon, Jan 23, 2017 at 10:02 AM, Craig Servin <
> cservin-varnish at cromagnon.com> wrote:
>
>> Hi Jan,
>>
>> You might want to consider using the libvmod-xkey and then having backend
>> changes just tell varnish to invalidate based on that secondary key.
>>
>> Cheers,
>>
>> Craig
>>
>>
>>
>> On 2017-01-23 06:56, Jan Hugo Prins | BetterBe wrote:
>>
>>> Hello,
>>>
>>> We are currently investigating the use of Varnish for our
>>> infrastructure. In the software we build, we depend on the
>>> If-None-Match header and the use of ETAG's.
>>> The API we have created creates mainly JSON objects, and they differ
>>> in size from a few hundreds of bytes to several megabytes. A lot of
>>> these JSON objects are perfectly suited for caching, until someone
>>> changes a parameter and this can happen at any moment. That is also
>>> why we keep a record of all ETAG's and we invalidate them when needed.
>>>
>>>
>>> What we would like to do is cache created JSON object in front of our
>>> production environment and when someone requests the same calculation
>>> that someone else has requested before and the ETAG is still valid,
>>> send out the cached object. But this basicly implies the following
>>> workflow:
>>>
>>
>>
>> _______________________________________________
>> 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/20170123/332ba08f/attachment.html>
More information about the varnish-misc
mailing list