I was wondering if it's possible to let Varnish to cache based on Backend server response header? For example, if Backend response header has "cache_ttl = 60", then Varnish will cache it for 60 seconds. If the cache_ttl = 0 or is not exist in Backend, Varnish will not cache for that object at all.

This is how varnish works by default - it respects the max-age, Cache-Control fields and Expires headers.

You can override it in vcl_fetch by changing the beresp.ttl. For example:

if (beresp.ttl < 5m) {
        set beresp.ttl = 5m;
}



rr

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

Reply via email to