VCL not cache but deliver

Damian Serwin damian.abel at dserwin.me
Mon May 23 19:46:02 CEST 2016


Hi,
thanks a lot! It is working as expected now.

> Am 22.05.2016 um 13:54 schrieb dserwin:
>> I have question related to Varnish VCL. I want to write vcl which under
>> some conditions will not be caching object downloaded from backend but
>> only deliver it to the client. I was trying to use vcl_backend_response
>> subroutine, but returning (abandon) results in returning 503 Service
>> Unavailable to the client. I'm using varnish 4.1.2.
> Abandon aborts the backend fetch, see the state diagram:
> https://www.varnish-cache.org/docs/4.1/reference/states.html
>
> You don't want to cancel the download from backend, you want
> to tell varnish not to cache the object, but to deliver it.
>
> In vcl_backend_response you can
> set beresp.uncacheable = true;
> in order to prevent caching of the fetched object.
>
> See https://www.varnish-cache.org/docs/4.1/reference/vcl.html
>
> Example:
>
> sub vcl_backend_response {
>      if (put your condition here) {
>          set beresp.uncacheable = true;
>          return (deliver);
>      }
> }
>
> Kind regards
> Daniel




More information about the varnish-misc mailing list