Varnish 4 Not Obeying no-store
Per Buer
perbu at varnish-software.com
Thu Jan 7 14:24:27 CET 2016
On Thu, Jan 7, 2016 at 2:01 PM, Debraj Manna <subharaj.manna at gmail.com>
wrote:
> Hi,
>
> I have a response in which no-store is set. But varnish is still caching
> the response for default 2 mins.
> (..)
> By vcl_backend_response looks something like below:-
>
> sub vcl_backend_response {
> if (bereq.url ~ "^/rde_server/") {
> set beresp.ttl = 300s;
> return(deliver);
> }
> if(beresp.http.Cache-Control ~ "no-store|no-cache") {
> return(deliver);
> }
> unset beresp.http.Cache-Control;
> }
>
> Can some one let me know what is going wrong or I have to do some special
> handling in vcl so that varnish does not cache the response with no-store
> set in Cache-Control?
>
You are using the wrong action. return(deliver) doesn't mark the object as
uncacheable. It only marks it as OK for delivery to the client.
Do something like this:
if(beresp.http.Cache-Control ~ "no-store|no-cache") {
set beresp.ttl = 120s;
set beresp.uncacheable = true;
(..)
This will create a hit-for-pass object to stop serialised access to the URL
and
--
*Per Buer*
CTO | Varnish Software AS
Cell: +47 95839117
We Make Websites Fly!
www.varnish-software.com
<http://info.varnish-software.com/signature>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20160107/c30f4760/attachment.html>
More information about the varnish-misc
mailing list