Problem/Motivation
In the past, Varnish has fetched the content from the backend in the same thread as the client request. In Varnish 4 we have split the client and backend code into separate trheads allowing for some much requested improvements. This split allows Varnish to refresh content in the background while serving stale content quickly to the client.
This split has also necessitated a change of the VCL-functions, in particular functionality has moved from the old vcl_fetch method to the two new methods vcl_backend_fetch and vcl_backend_response.
The split also restricts the availability of req.esi_level
to client code. It is present in vcl_recv
, but neither in vcl_backend_fetch
nor in vcl_backend_response
.
Proposed resolution
In order to minimalize the changes needed to migrate from Varnish 3 to Varnish 4, extract the logic from vcl_miss
into vcl_recv
and rewrite the necessary parts of vcl_fetch
.
Also Varnish 4 does not cache anything if Cache-Control
has the private
directive. Therefore remove that from ESI responses. Note that responses prepared like this will never be sent to the client (and neither to downstream proxies).
Remaining tasks
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#1 | adapt_varnish_3-2482227-1.patch | 4.09 KB | znerol |
Comments
Comment #1
znerol CreditAttribution: znerol commentedComment #4
znerol CreditAttribution: znerol commented