How to disable Varnish Cache from within a PHP script? -
i distribute php script , lot of people having trouble varnish cache on shared hosting accounts.
this code @ top of php script. still "varnish: hit" in response headers (and script doesn't work correctly).
header('pragma: no-cache'); header('cache-control: private, no-cache, no-store, max-age=0, must-revalidate, proxy-revalidate'); header('expires: tue, 04 sep 2012 05:32:29 gmt');
one hosting provider said impossible disable varnish within php script, setting cache headers above. seems .. .. silly? seems match experience.
so there way disable/skip varnish within php? or varnish (by default) ignore these cache headers set php?
thanks jens-andré koch - i'll include varnish instructions along php script make ignore no-cache responses:
sub vcl_fetch { if (beresp.http.cache-control ~ "(no-cache|private)" || beresp.http.pragma ~ "no-cache") { set beresp.ttl = 0s; } }
you have configure varnish avoid caching page. modify vcl detect headers... specify own header turn caching off file or add statically non-cached config.
Comments
Post a Comment