On 25 March 2012 05:15, Ryan Chan <[email protected]> wrote:
> Seems Varnish is caching too aggressively, e.g. I have a index.php does not
> send out last-modifieid,cache-control, Varnish still cache it.
>
> my default.vcl
>
> backend default {
>     .host = "127.0.0.1";
>     .port = "8080";
> }
>
> Is it possible to turn off this strange behaviors?

Your responses are probably being cached because of the default
default_ttl setting, which you'll find detailed a little way down
https://www.varnish-cache.org/docs/3.0/reference/varnishd.html#run-time-parameters.

However, rather than changing that run-time setting, you may want to
force Varnish always to contact the back-end next time for those
resources which don't dictate an explicit TTL. This would be both more
visible and more tunable, later on.

This VCL would achieve that goal, I believe (untested, but taken from the docs):

sub vcl_fetch {
  if (beresp.ttl <= 0s) {
    # Mark as "Hit-For-Pass" for the next 2 minutes
    set beresp.ttl = 120s;
    return (hit_for_pass);
  }
}

HTH,
Jonathan
-- 
Jonathan Matthews
London, Oxford, UK
http://www.jpluscplusm.com/contact.html

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

Reply via email to