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
-- 
https://emailselfdefense.fsf.org
https://pgp.mit.edu/pks/lookup?op=get&search=0xB4DD34660B6F0F1B
https://pgp.key-server.io/0xB4DD34660B6F0F1B
Fingerprint: 366C BC38 B09B 4BFC 38A7  3CBC B4DD 3466 0B6F 0F1B

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
varnish-misc mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Reply via email to